Posts

Showing posts from June, 2014

Can I still get Facebook Friends with An App Created BEFORE April 30 2014? -

i know whole april 30 policy of big brother doom facebook has introduced, read somewhere: "for apps active before april 30th, these apps can call either graph api v2.0 or graph api v1.0, graph api v1.0 deprecated on april 30th 2015." does mean if have app active before april 30th 2014, still able use api v1.0 users friends until next year? i have read depends if user logs app api1.0 or api2.0 ... how users have ability choose api, , mean have access user's friends if use v1.0, not if use v2.0? apps created before april 30th 2014 can still friends, until april 30th 2015. you can force older apps use newer api version: https://developers.facebook.com/docs/javascript/quickstart/v2.1 (see "version" parameter in init-function) you can add version tag in api call, see changelog more information that: https://developers.facebook.com/docs/apps/changelog keep in mind can´t force new app use older version of api.

assertion - Finding alphanumeric using ruby -

new forum. trying run test find â or € using assertion text.include? "â" , "€" but getting errors. try: text.include?("â") || text.include?("€") or: /â|€/.match(text)

Find words and copy into next column in Excel -

Image
i find , copy text next column in excel. have column a, text or sentences. want find particular word , copy word next column column b if word available in text of column a. i have solution single word search , copy want apply multiple search , copy of different words: =if(isnumber(search("processes", a4)), mid(a4, search("processes", a4), 9), "") example: suppose column contains text this: "execution of procedure , processes". "all procedures correctly updated" "processes going smoothly". i want search word "processes , procedure" , should copy in column b (cell 1) "only if" either processes or procedure in text. could please me out in this? if need return 1 of words, can use: =lookup(2,1/isnumber(search({"processes","procedures"},a4)),{"processes","procedures"}) or, can, example, put search words cells: c1: processes d1: procedu

jquery - Javascript Callbacks within Object Methods -

this more question involving why 1 of solutions works , other doesn't. i'm new js, been learning couple of months , whilst have of basics down, feel knowledge of best practice lacking. i'm creating animated hero image top of infographic , on i'm using js create 2 trains moving across screen, 1 left right , other right left. created following code, worked: $(document).ready(function() { var anim = { train1: $(".train-one"), train2: $(".train-two"), moveleft: function(percent, duration) { anim.train1.animate({left: percent}, duration, "linear") }, moveright: function(percent, duration) { anim.train2.animate({right: percent}, duration, "linear") }, lefttrain: function() { anim.moveleft("33%", 1000, anim.moveleft) anim.moveleft("66%", 200

sql - Bringing together coalesce, count, case and clauses -

i'm new please bear me. i'm writing query need count number of rows 2 specific values, i have used following result of different values in 1 field need know results if field set specific value. pulled following previous question on site: coalesce(count(case when cw.mainjobrole = 2 1 end),0) alljobroles_2, coalesce(count(case when cw.mainjobrole = 3 1 end), 0) alljobroles_3, coalesce(count(case when cw.mainjobrole = 4 1 end), 0) alljobroles_4, coalesce(count(case when cw.mainjobrole = 7 1 end), 0) alljobroles_7, coalesce(count(case when cw.mainjobrole = 8 1 end), 0) alljobroles_8, coalesce(count(case when cw.mainjobrole = 23 1 end), 0) alljobroles_23, coalesce(count(case when cw.mainjobrole = 24 1 end), 0) alljobroles_24, coalesce(count(case when cw.mainjobrole = 25 1 end), 0) alljobroles_25' as part of larger query, want above if cw.emplstatus = 1 you can add condition where clause: coalesce(count(case when cw.mainjobrole = 2 , cw.emplstatus = 1 1 e

android - ArrayAdapter from ArrayList showing resource ID not value -

i attempting populate spinner arraylist. the issue have instead of displaying values in arraylist, spinner showing full path resource id instead! my code @override public void cartonmoveoptions(arraylist<barcodespinner> bspinner) { spinner barcodechoice = (spinner) rootview.findviewbyid(r.id.cartonchoices); barcodechoice.setvisibility(view.visible); arrayadapter<barcodespinner> = new arrayadapter<barcodespinner>(getactivity(), android.r.layout.simple_spinner_item, bspinner); a.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); barcodechoice.setadapter(a); } barcodespinner contains 2 lines, , content single string each line. can point out wrong? this barcodespinner class public class barcodespinner { string barcode; public string getbarcode() { return barcode; } public void setbarcode(string barcode) { barcode = barcode; } } answer: add @override public string tostri

ios - Text Selection in WKWebView: WKSelectionGranularityCharacter -

i've got app uses web view text can selected. it's long been annoyance can't select text across block boundary in uiwebview. wkwebview seems fix property on configuration: selectiongranularity . 1 of possible values wkselectiongranularitycharacter : selection endpoints can placed @ character boundary. sounds great! need. except when set on web view, can no longer select text @ all. going on? there else need set? has figured out? update: i've figured out following bugs: when there more 1 wkwebview in app selectiongranularity set wkselectiongranularitycharacter, recent 1 load can select text. i've filed bug 18441138. if there click handler attached element inside body in html content of wkwebview selectiongranularity set wkselectiongranularitycharacter, text selection doesn't work inside element. i've filed bug 18440833. text selection fails in wkwebview after you've entered edit mode on uitextview somewhere else in app until wkwebv

Ruby: How to count the number of times a string appears in another string? -

i'm trying count number of times string appears in string. i know can count number of times letter appears in string: string = "aabbccddbb" string.count('a') => 2 but if search how many times 'aa' appears in string, two. string.count('aa') => 2 i don't understand this. put value in quotation marks, i'm searching number of times exact string appears, not letters. here couple of ways count numbers of times given substring appears in string (the first being preference). note (as confirmed op) substring 'aa' appears twice in string 'aaa' , , therefore 5 times in: string="aaabbccaaaaddbb" #1 use string#scan regex contains positive lookahead looks substring: def count_em(string, substring) string.scan(/(?=#{substring})/).count end count_em(string,"aa") #=> 5 note: "aaabbccaaaaddbb".scan(/(?=aa)/) #=> ["", "", "", &quo

c++ - How to copy a string into a char array with strcpy -

i trying copy value char. my char array is char sms_phone_number[15]; by way, tell me if should write (what benefic/difference?) char * sms_phone_number[15] below displays string: "+417611142356" splitedstring[1] and want give value sms_from_number // strcpy(sms_from_number,splitedstring[1]); // op's statement strcpy(sms_phone_number,splitedstring[1]); // edit i've got error, think because splitedstring[1] string, isn't? sim908_cooking:835: error: invalid conversion 'char' 'char*' so how can copy correctely. tried sprintf without success. many thank help. cheers i declare spliedstring this // slitstring #define nbvals 9 char *splitedstring[nbvals]; i have function splitstring("toto,+345,titi",slitedstring) void splitstring(char *ligne, char **splitedstring) { char *p = ligne; int = 0; splitedstring[i++] = p; while (*p) { if (*p==',') { *p++ = '\0';

itunesconnect - iTunes connect upload issue (binary size) -

i trying upload update existing app have in appstore. created archive, passed validation , submitted file via application loader. at end of upload got following message : the resulting api analysis large when upload app mac store have no idea means , found sources saying warning , not rejected. looking in build details of uploaded build in new itunes connect page noticed file size smaller generated ipa file created xcode (2.69mb against 12.9mb) and 1 last thing, under processing tab uploaded build appears 4 times status 'created' each. did bumped upon these issues above? have bad feeling build rejected "invalid binary"... ok, contacted apple support , said they'll it... few days after file size in itunesconnect has been updated right size , app got approved way long after;) so apparently glitch on site if of notice this, either wait few days updated or contact support (but don't try reject , upload again happen again until fix

Outlook VBA script will not run -

Image
i created vba script in outlook 2010 way run clicking on play button while in outlook vba indicated in image below: why won't run when select vba script menu indicated in image below? have signed vba script using "selfcert.exe". the other 2 vba scripts in list run when selected menu. below code of vba script not run: sub replaceips() dim insp inspector dim obj object set insp = application.activeinspector set obj = insp.currentitem obj.htmlbody = replace(obj.htmlbody, "192.168.1", "255.255.255") set obj = nothing set insp = nothing end sub the above vba script supposed find , replace instances of "192.168.1" "255.255.255" in body of email being composed. a module name can't contain macro of same name. rename module replaceips else or rename macro /subroutine replaceips else. if both same won't resolve properly

php - Catchable fatal error: Argument 1 passed to ... must be an instance of ..., boolean given, called in ... on line ... and defined in ... on line -

i have added cms server. wondering why keep getting error on page purchase subscription. this error; catchable fatal error: argument 1 passed objectarray::frommysqliresult() must instance of mysqli_result, boolean given, called in c:\inetpub\wwwroot\model\factoryobjects\user.php on line 71 , defined in c:\inetpub\wwwroot\lib\objectarray.php on line 284 line 71 has following; public function getorders() { $objectarray = new objectarray(); $result = $this->getconnection()->query("select * vip_orders user_id = '" . $this->id. "'"); $objectarray->frommysqliresult($result); (<line 71<) return $objectarray; } line 284 has following; public function frommysqliresult(mysqli_result $result) (<line 284<) { $this->clear(); while ($row = $result->fetch_object()) { $this->add($row); } return $this; } please let me know if other information necessary me fix error! thank

java - Hibernate to Eclipselink, PostgreSQL and UUID -

here's had write uuid working primary key, full uuid types (on ends) in hibernate. since relies on hibernate specific code, have convert code work on eclipselink? package com.lm.model; import org.hibernate.annotations.genericgenerator; import org.hibernate.annotations.type; import javax.persistence.*; import javax.validation.constraints.notnull; import javax.validation.constraints.size; import java.util.uuid; @entity @table(name = "tasks") public class task { @id @notnull @type(type = "pg-uuid") @generatedvalue(generator = "myuuidgenerator") @genericgenerator(name = "myuuidgenerator", strategy = "uuid2") @column(name = "task_id", columndefinition = "uuid") private uuid id; @notnull @size(min = 1, max = 100) private string description; public string getdescription() { return description; } public void setdescription(final string description) { this.description = description; } public uuid get

orm - Laravel eloquent: get data with model wherePivot equal to custom field -

i have eloquent object performer has albums , albums have images here setup: model performer->albums(): public function albums() { return $this->belongstomany('album','performer_albums','performer_id','album_id'); } model album->images() public function images() { return $this->belongstomany('image','album_images','album_id','image_id')->withpivot(['type','size']); } i have performer object stored such: $performer = performer::where...->first(); now need performer's albums images size 'large' so avoid nesting queries, can use with()? i tried $performer->albums() ->with('images') ->wherepivot('size','large') ->get(); but laravel tells me it's trying use wherepivot performer-album relationship (m-2-m) ps. aware can this, $performer = performer::with('albums')

ios - How to programmically add an UILabel to my UICollectionViewCell -

i have custom uicollectionviewcell , has scrollview child. want programically add uilabel scrollview. class myuicollectionviewcell : uicollectionviewcell { var newlabel = uilabel? required init(coder adecoder: nscoder) { super.init(coder: adecoder) var labelframe = cgrect(x: 10, y: 439, width: 355, height:0); newlabel = uilabel(frame: labelframe) self.scrollview.addsubview(newlabel!) } } i tried doing in init() or init(code adecoder :nscoder) method. exception saying scollview nil. can please tell me best place add uilabel? thank you. add label in awakefornib. iboutlets still nil @ time init method called.

int - How to count to 100 in a different base than 10 (java program) -

import java.util.scanner; public class problem5 { public static void main(string args[]) { system.out.println("base calculator"); system.out.println("input number greater 0 , less 10 use base"); system.out.println("------------------------------------------------------------------"); system.out.println("base: "); //menu scanner input = new scanner(system.in); int base = 0; int basenumber[]; basenumber = new int[1000001]; base = input.nextint(); int remainder, tens; if (base <= 0 || base >=10) { //only working parameter system.out.println("this calculator not work bases less 1 or bases greater 9. please re-run program."); return; } else { system.out.print("(this means base " + base + " calculator. hence, allowed values corresponding base 10 values of 0 through 102 be: "); for(int = 0; i<=101; i++) { //a sample of

python - Adding a legend to a plot of a list -

i'm not sure how add legend set of data . i've tried few online guides none seem of help. l_list = np.linspace(0, 500, 6) #kg plt.hold(true) theta = 84 print("begin simulation...") print() in l_list: print("mass = ", i, "kgs") x, y, t = flightenvelope(i, theta) #t, m, t = flightenvelope(l, i) plt.plot(x,y) print() print("simulation complete.") print() print("=============================================================") print("=============================================================") plt.ylabel("height of rocket (m)") plt.xlabel("horizontal distance traveled (m)") plt.title("trajectory of rocket") plt.grid(true) plt.show() just use: plt.legend(["a", "b", "c"])

reset python interpreter for logging -

i new python. i'm using vim python-mode edit , test code , noticed if run same code more once, logging file updated first time code run. example below piece of code called "testlogging.py" #!/usr/bin/python2.7 import os.path import logging filename_logging = os.path.join(os.path.dirname(__file__), "testlogging.log") logging.basicconfig(filename=filename_logging, filemode='w', level=logging.debug) logging.info('aye') if open new gvim session , run code python-mode, file called "testlogging.log" content info:root:aye looks promising! if delete log file , run code in pythong-mode again, log file won't re-created. if @ time run code in terminal this ./testlogging.py then log file generated again! i checked python documentation , noticed line in logging tutorial ( https://docs.python.org/2.7/howto/logging.html#logging-to-a-file ): a common situation of recording logging events in file, let’s @ next

sql - Query multiple tables -

i have following tables customers (id, name) customerpricerelations (customer_id, sales_price_id) # jointable salesprices (id, margin) productsalesprices (product_id, sales_price_id) # jointable given customer , product, want fetch matching salesprice. i'm kind of stuck , appreciate help this mssql aren't using, should help. walk relations know until don't know. select sp.id, sp.margin salesprices sp left outer join productsalesprices ps on sp.id = ps.sales_price_id left outer join customerpricerelations cr on ps.sales_price_id = cr.sales_price_id left outer join customers c on cr.customer_id = c.id c.id = <your customer id> , ps.product_id = <your product id>

javascript - Zurb Foundation Offcanvas Menu stops working after toggling programmatically -

i use zurb foundation 5 in wordpress theme offcanvas menu, working fin in gerneral, have come across problem: in addition hamburger icon in top bar, give option open menu when clicking on fixed position div element .back-to-menu. achieve this, used method open offcanvas menu programmatically described in zurb's docs. while works fine, after i've clicked on div.back-to-menu open menu , close menu again, can't seem open menu clicking on hamburger icon in top bar more. this code open menu: jquery('.back-to-menu').click(function(event) { event.preventdefault(); jquery('html, body').animate({scrolltop: 0}, duration); settimeout(function() { $('.off-canvas-wrap').foundation('offcanvas', 'show', 'move-right'); }, duration); return false; }) can help? this seems bug in foundation, when execute script on foundation documentation page same error occurs, menu opens , closes broken. a wo

c - Loop iterates as many time as the number of characters in input -

i know title weird. didn't know how put in words. basically, have loop asks user if want run program again, "would run again (y/n). if enter 1 character loop 1 time. if enter 5 characters "hello" iterate 5 times. ex. run again? (y/n) q would run again? (y/n) hello would run again? (y/n) would run again? (y/n) would run again? (y/n) would run again? (y/n) would run again? (y/n) this code: char a='y'; while(a=='y' || a=='y') { printf("enter p value: \n"); scanf("%d",&p); printf("enter q value: \n"); scanf(" %d",&q); printf("enter k value: \n"); scanf(" %d",&k); (i=p; i<q+1; i++) { q=i; sum=0; count=0; while(q>0) { count++; r = q%10; sum = sum + pow(r,k); q = q/10; } if ( == sum && i>1 && count==k ) {

country - Magento - Dropdown box -

does know how dropdown box one ? i'm trying list of countries separate delivery prices. p.s. trying put on cms page. you can create drop down in front end below <?php $_countries = mage::getresourcemodel('directory/country_collection') ->loaddata() ->tooptionarray(false) ?> <?php if (count($_countries) > 0): ?> <select name="country" id="country"> <option value="">-- please select --</option> <?php foreach($_countries $_country): ?> <option value="<?php echo $_country['value'] ?>"> <?php echo $_country['label'] ?> </option> <?php endforeach; ?> </select> <?php endif; ?> and admin view <?php $fieldset->addfield('country', 'select', array(

linked list - Inserting node at the end of LinkList in C -

Image
i don't have problems insert nodes in middle or @ beginning of linkedlist . however, @ end different. when try print values, gives me address: now, here how build linkedlist : employeedata ed[4]; node *head = null, *list = null; (int = 0; < 4; i++) fscanf(file, "%d %s %d %d %lf", &ed[i].emp_id, ed[i].name, &ed[i].dept, &ed[i].rank, &ed[i].salary); head = (node *)malloc(sizeof(node)); head->employee = ed[0]; head->next = null; list = head; (int = 1; < 5; i++){ node *ptr = (node *)malloc(sizeof(node)); ptr->employee = ed[i]; ptr->next = null; head->next = ptr; head = head->next; } here how add nodes it: node *newnode = (node *)malloc(sizeof(node)), *temptr = list, *endnode = list; newnode->employee.emp_id = id; strcpy(newnode->employee.name, name); newnode->employee.dept = dept; newnode->employee.rank = rank; newnode->employee.salary = salary; newnode->next = null; whi

common lisp - How to use example functions? -

this program taken paradigms of artificial intelligence programming: case studies in common lisp peter norvig, 1992, morgan kaufmann publishers, inc. if compile , load debug window, how use it? ; function returns random element of list choices (defun random-elt (choices) "choose element list @ random." ;; elt returns (n + 1)th element of list choices ;; random returns random integer no large number of ;; elements in list choices (elt choices (random (length choices)))) ; function returns random element of given set , returns ; in list (defun one-of (set) "pick 1 element of set, , make list of it." (list (random-elt set))) ; define sentence noun-phrase + verb phrase (defun sentence () (append (noun-phrase) (verb-phrase))) ; define noun phrase article + noun (defun noun-phrase () (append (article) (noun))) ; define verb phrase verb + noun phrase (defun verb-phrase () (append (verb) (noun-phrase))) ; function returns randomly selecte

ios - How do I get the App version and build number using Swift? -

i have ios app azure back-end, , log events, logins , versions of app users running. how can return version , build number using swift? edit as pointed out @azdev on new version of xcode compile error trying previous solution, solve edit suggested unwrap bundle dictionary using ! let nsobject: anyobject? = nsbundle.mainbundle().infodictionary!["cfbundleshortversionstring"] end edit just use same logic in objective-c small changes //first nsobject defining optional anyobject let nsobject: anyobject? = nsbundle.mainbundle().infodictionary["cfbundleshortversionstring"] //then cast object string, careful, may want double check nil let version = nsobject string i hope helps out. david

Separating unit tests and integration tests in Go -

is there established best practice separating unit tests , integration tests in golang (testify)? have mix of unit tests (which not rely on external resources , run fast) , integration tests (which rely on external resources , run slower). so, want able control whether or not include integration tests when go test . the straight-forward technique seem to define -integrate flag in main: var runintegrationtests = flag.bool("integration", false , "run integration tests (in addition unit tests)") and add if-statement top of every integration test: if !*runintegrationtests { this.t().skip("to run test, use: go test -integration") } is best can do? searched testify documentation see if there perhaps naming convention or accomplishes me, didn't find anything. missing something? @ainar-g suggests several great patterns separate tests. this set of go practices soundcloud recommends using build tags ( described in "build co

clojure - Difference between Use, Require and Import -

can 1 give me example answer differentiate between use, require , import. i hope can me. require ensures clojure namespace has been compiled , instantiated. optionally updating source if provided :reload key optionally creating aliases if :as key provided. optionally modifying current namespace include mappings required namespace's vars, if :refer key provided. mapping visible inside requiring namespace, , not transitive other namespaces requiring it. use identical require in action, except default modify current namespace via refer function include target namespace's vars if :refer :all had been provided. accepts :exclude , :only , , :rename keys guide modification of current namespace. import adding mappings of class names current namespace, package qualifiers not need used.

Batch script to modify .properties file -

this question has answer here: how can find , replace text in file using windows command-line environment? 25 answers i have properties file (server.properties) , looks this: ipaddress=10.x.x.x servername=somename and lot of other values. let's located @ c:\server\server.properties there way modify values using batch script. what if want change servername "somename" "myname" ? can't use line numbers because can change anytime. this not duplicate of how can find , replace text in file using windows command-line environment? i trying figure out how replace value of property. not replacing 1 word another. thanks. @echo off setlocal set "sourcedir=c:\106x" ( /f "usebackqdelims=" %%a in ("%sourcedir%\q25967146.txt") ( /f "tokens=1*delims==" %%g in ("%%a") ( if /i &

perl - Why doesn't Catalyst support routes dispatching -

i'm wondering why catalyst not have routes-based dispatching mechanism. have insights on that? i know of achievable chained methods, struggle them (my bad, know). used routes in mojolicious , feel more comfortable. i'm tempted roll own based on path::router , before embark on such project thought i'd ask wise people. and, while i'm @ it, there source understanding dispatching in catalyst , beside reading code? thanks- it possible construct routes dispatching mechanism in catalyst. this question , answer discusses it, , meaty part can found in this advent calendar article . that first link refer definitive guide catalyst, book worth getting hold of. dispatching discussed @ length therein.

android - Eclipse: code editor doesn't open -

i'm having problem in eclipse can't open code editor. tried restart eclipse several times , restarted pc nothing changed. can me or give me tips how fix it? goto --> windows menu reset perspectives

encryption - Encrypt a file in Android then decrypt it in PC -

i want collect data , write in encrypted file using public key (in android). send file pc read. in pc need create application decrypt file too. how can , how share key securely? if have encrypted file using public key, file can decrypted using associated private key. called asymmetric encryption. sending application private key out of application context severe security breach. public keys meant shared publicly, not private key. in case can encrypt file on android device using pc/sever public key, send server , decrypt @ server/pc using pc's private key. best solution.

c# - What is the best way to have a score value for cards in a deck -

i wanted know best way create deck of cards score or calculate score ? see below have calculate class deal cards score, check card , give value , calculate winner. im creating blackjack game , have gotten cards randomly generate in having trouble score each card... i going show classes have far can sense of im doing , im at. i know lot of code not ailing people try , please try , bear me... card class public static class card { // should enumes eg. privat enume suite{} private static string[] suite = new string[4] {"clubs", "hearts", "spades", "diamonds" }; private static string[] facevalue = new string[13] {"ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "jack", "queen", "king" }; public static list<string> createdeck() { list<string> deckofcards = new

ios - How to open youtube in webview in ios7 -

i'm trying load youtube in uiwebview in ios7 device using embedded string,its not loading. in simulator , below ios7 devices working good. please suggest me how solve this. i'm using below, nsstring *htmlstring = [nsstring stringwithformat:@"<html><head><meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = yes, width = 320\"/></head><body style=\"background:#00;margin-top:0px;margin-left:0px\"><div><object width=\"320\" height=\"180\"><param name=\"movie\" value=\"http://www.youtube.com/v/%@&f=gdata_videos&c=ytapi-my-clientid&d=ngf83uyvrg8ed4rfekk22mdol3quimvmv6ramm\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/%@&f=gdata_videos&c=ytapi-my-clientid&d=ngf83uyvrg8ed4rfekk22mdol3quimvmv6ramm\"type=\&qu

filter - can't get apply_filter to work in wordpress thematic -

i learninig create templates in wordpress using thematic framework in header file find: // filter provided altering output of header opening element echo ( apply_filters( 'thematic_open_header', '<div id="header">' ) ); // action hook creating theme header thematic_header(); echo ( apply_filters( 'thematic_close_header', '</div><!-- #header-->' ) ); i want add wrapper div element around div id="header".../div created above i have tried edit apply_filter lines this: echo ( apply_filters( 'thematic_open_header', '<div id="headerwrapper"><div id="header">' ) ); but doesn't work, printout out div id="header" how can create html want to? thanks filters used in functions.php or in plugin this: add_filter( 'thematic_open_header', function(){ return '<div id="headerwrapper"><div

oracle10g - counting in sql in subquery in the table -

dno dname ----- ----------- 1 research 2 finance en ename city salary dno join_date -- ---------- ---------- ---------- ---------- --------- e1 ashim kolkata 10000 1 01-jun-02 e2 kamal mumbai 18000 2 02-jan-02 e3 tamal chennai 7000 1 07-feb-04 e4 asha kolkata 8000 2 01-mar-07 e5 timir delhi 7000 1 11-jun-05 //find departments have more 3 employees. my try select deptt.dname deptt,empl deptt.dno=empl.dno , (select count(empl.dno) empl group empl.dno)>3; here solution select deptt.dname deptt,empl deptt.dno=empl.dno group deptt.dname having count(1)>3;

javascript - How to trigger the toggle on one click instead of two -

i using simple toggle this: function toggle_visibility(id) { var e = document.getelementbyid(id); if(e.style.display == 'block') e.style.display = 'none'; else e.style.display = 'block'; } and html this: <div id="income"> <h5 onclick="toggle_visibility('incometoggle');">income</h5> <div id="incometoggle"> <h6>income total</h6> </div> </div> at moment, need click twice on heading div close. how can make close 1 click? http://jsfiddle.net/4w3ynj40/ first check condition display none function toggle_visibility(id) { var e = document.getelementbyid(id); if (e.style.display == 'none') e.style.display = 'block'; else e.style.display = 'none'; } jquery $("h5").click(function() { $("#incometoggle").toggle(); }); demo

objective c - iOS >> UILocalNotification Got Lost -

in app there may scenario several local notifications fired closely close 'fire date'. if app in foreground, seems appdelegate catches them all, via didreceivelocalnotification method. but... in case app in background or closed, , click on 'popup' pops in home screen, method captures first notification, while others seem lost; , need them all... anyone? for local notifications did tried below? nsarray *pendingnotifications = [[[uiapplication sharedapplication] scheduledlocalnotifications] sortedarrayusingcomparator:^(id obj1, id obj2) { if ([obj1 iskindofclass:[uilocalnotification class]] && [obj2 iskindofclass:[uilocalnotification class]]) { uilocalnotification *notif1 = (uilocalnotification *)obj1; uilocalnotification *notif2 = (uilocalnotification *)obj2; return [notif1.firedate compare:notif2.firedate]; } return nsorderedsame; }]; // if there pending notifications -

linux - BeagleBone Black UART1 enabled, but does not send or receive data -

i have (finally) managed uart1 going on bbb using instructions here: http://tenderlovemaking.com/2014/01/19/enabling-ttyo1-on-beaglebone.html doing ls -la /dev/ttyo* gives crw--w---- 1 root tty 248, 0 sep 22 14:50 /dev/ttyo0 crw-rw---- 1 root dialout 248, 1 sep 22 14:50 /dev/ttyo1 but cannot seem write or read anything. echo "wibble" > /dev/ttyo1 does nothing (i ran screen /dev/ttyo1 115200 in terminal window). there further step data flowing through serial port? note: beaglebone revision b6.

java - Send raw RIL request -

i know if has example of how can send ril request android using ril constants ril_request_get_sim_status ril_request_dial ril_request_send_sms and how results request using android java base api. methods can found in ril.java example send ril request: import com.android.internal.telephony.phonefactory; import com.android.internal.telephony.phonebase; phonebase phone = (phonebase)phonefactory.getdefaultphone();//or phonefactory.getphone(sim_id); //ril_request_get_sim_status phone.mci.geticccardstatus(result); //ril_request_dial phone.mci.dial (address, clirmode, result); //ril_request_send_sms phone.mci.sendsms (smscpdu, pdu, result); the result message binded handler before calling above method, , once complete corresponding result message sent handler, result.obj. samples decode result can found in following files, ril_request_get_sim_status : uicccontroller.java ril_request_dial: gsmcalltracker.java ril_request_send_sms: gsmsmsdispatcher.java

spring batch - Wtiring xml with muliple root elements for StaxEventItemWriter -

i have input xmls file following structure. i'm able read header, data , trailer using 3 different steps in job , persiting data in database. i'm able read data database , write these elements in 3 different out put files, however, need create output file same structure of input file. how combine header, data , trailer , create output xml file using staxeventitemwriter? update - there 1 instance of header , trailer, data element 1 n. <?xml version="1.0" encoding="utf-8"?> <rootelement> <header> <element1>value</element1> <element2>value</element2> </header> <data> <element1>value</element1> <element2>value</element2> </data> <data> <element1>value</element1> <element2>value</element2> </data> <data> <element1>value</element1>

c# - Query only returns groups that have users -

the code below returns list of groups , associated members on machine. why return populated groups. example create new user group on machine , not returned on query. if add user user group return in query. there fix query? c# code var sgroupname = ""; var susername = ""; managementobjectsearcher searchresult = new managementobjectsearcher("root\\cimv2", "select * win32_groupuser"); foreach (managementobject queryobj in searchresult.get()) { sgroupname = queryobj["groupcomponent"].tostring().split(new[] { "name=" }, stringsplitoptions.none).last().trim('"'); susername = queryobj["partcomponent"].tostring().split(new[] { "name=" }, stringsplitoptions.none).last().trim('"'); } try this: var searchresult = new managementobjectsearcher("root\\cimv2", "select * win32_group");

Where is my vim color scheme coming from? -

when edit fortran file vim on imac uses nice color scheme. send color scheme file friend, cannot find coming from. in vim :colorscheme command lists "default". the default.vim file in /usr/share/vim/vim73/colors has following non comment lines: hi clear normal set bg& hi clear if exists("syntax_on") syntax reset endif let colors_name = "default" i have tested of color schemes in /usr/share/vim/vim73/colors , none of them 1 vim using. my vimrc file contains following non comment lines: set modelines=0 set nocompatible " use vim defaults instead of 100% vi compatibility set backspace=2 " more powerful backspacing au bufwrite /private/tmp/crontab.* set nowritebackup au bufwrite /private/etc/pw.* set nowritebackup :let fortran_free_source=1 :hi link fortrantab none :syntax on :highlight normal ctermfg=grey ctermbg=black so nice color scheme coming from? you using vim default colorscheme, there no file. defaul

Asp.net vNext early beta publish to IIS in windows server -

how can publish asp.net vnext application , have tried deploy file system, 1) why in published file system approot has source code 2) have ftp files in wwwwroot iis website folder still not working do need install on iis7., windows server 2012 first, asp.net vnext near primetime. should absolutely not using production code. questions: why in published file system approot has source code one of main selling points of vnext compile in memory features of rosalyn. source code published, because there no pre-compilation more. it's more scripting languages php, ruby, etc. now, can make change source , instantly see changes. i have ftp files in wwwwroot iis website folder still not working because still preview, iis 8 (which what's running in windows server 2012, not iis 7), cannot support site published. have use command-line tool kpm pack application, builds old-school mvc application. see first section of https://github.com/aspnet/home/wiki/ftp-deploy-a

Find missing images selenium -

i need automate (using selenium) missing images on webpage. image can loaded in 3 ways: 1) <img src="http://something.com/google.png"> 2) <img src="/path/to/file/image.jpg"> 3) <div class="someicon" autoid="some-icon"></div> the above info can come css (for example .someicon { height: 97px; width: 93px; background-image: url("../assets/images/some_icon.png"); background-size: 93px 97px; } now these different way of loading images on html page, how can write automation identify whether image missing or not? problem 1) can solved using list<webelement> imageslist = _driver.findelements(by.tagname("img")); (webelement image : imageslist) { httpresponse response = new defaulthttpclient().execute(new httpget(image.getattribute("src");)); if (response.getstatusline().getstatuscode() != 200) // whatever want broken images } how 2) & 3) ? thanks, matee

r - How to predict values by using a model developed by linear mixed modelling with nesting effect? -

i have model developed using 5 variables in r. linear mixed modelling method selected develop model nesting effect. my r code model development below: model1 <- lmer(reduction.factor ~ (1|pai:open.wind) + (1|pai:temp) + (1|pai:height)+ (1|pai:density)+ pai , data = model) 4 parameters nested pai. to see how model predict in different conditions, have created different numbers 5 parameters data frame (called "case study"). it looks this: temp height density pai open wind 20.000 0.041 0.033 1.960 30.000 20.000 0.082 0.061 1.960 30.000 20.000 0.122 0.059 1.960 30.000 20.000 0.163 0.061 1.960 30.000 20.000 0.204 0.043 1.960 30.000 20.000 0.245 0.048 1.960 30.000 20.000 0.286 0.052 1.960 30.000 40.000 0.082 0.061 1.960 40.000 40.000 0.122 0.059 1.960 40.000 40.000 0.163 0.061 1.960 40.000 40.000 0.204 0.043 1.960 40.000 40.000 0.245 0.048 1.960 40.000 40.000 0.286

javascript - Saving an Image from URL in Parse.com using CloudCode -

i have been struggling saving file retrieve http request a few days now. here code: parse.cloud.httprequest({ url: "https://ss1.4sqi.net/img/categories_v2/food/vietnamese_88.png", success: function(httpimgfile) { console.log("httpimgfile: " + string(httpimgfile.buffer)); var imgfile = new parse.file("imgfile1.png", httpimgfile.buffer); object.set("location", "newyork"); //object pfobject retrieved earlier object.set("icon1", imgfile); object.save(null, { success: function(gamescore) { response.success("saved object"); }, error: function(gamescore, error) { response.error("failed save object"); } }); }, error: function(httpresponse) { console.log("unsuccessful http request"); response.e

Can a field initialized to an observable object become an array in knockout.js? -

i reading existing code. initially, code initializes property 'data': self.data = ko.observable({}); but afterwards, in function code assigns 'data' below. self.data not set observablearray below, used though array. no other code touches self.data before line when hits line before assignment, still ko.observable({}). self.data()[0] = ko.observable(""); i thinking legal syntax converting observable object array in knockout.js, if try put alert length alert(self.data().length), undefined. my question code do? it isn't observable array. it's object. javascipt object can access it's properties dot notation or index notation. link since javascript dynamically typed can add new properties existing objects. the following code adding new observable property existing object instance. self.data()[0] = ko.observable(""); here example visualize what's going on. var vm = function(){ var self = this; sel

if New MQ (message queue) is added to the existing functionality, then new properties file needs to be created? -

in existing functionality application keep on listening mq , when message arrives mq, programs injected through springs called , messages read jmsbytemessage , parsed , written oracle database. requirement new , different form of xml sent new queues, existing listening programs required job reading new messages. new functionality needs added new xmls. my question is, because new queue information/configuration should done in properties file. so, new queue information/configuration mentioned in same properties file different variable or new property file needs created new queue information/configuration?

java - Glassfish appclient deploys from EAR -- how is it executed? -

helloearacc , "hello world" using glassfish application client container (acc), deploys cli fine , runs f6 on netbeans. after initial run, it's possible run client cli. how client, helloearacc , executed outside of netbeans? when helloearacc created, project added helloear module ear deploys within ear appclient : thufir@dur:~$ thufir@dur:~$ glassfish-4.1/glassfish/bin/asadmin list-applications nothing list. no applications deployed target server. command list-applications executed successfully. thufir@dur:~$ thufir@dur:~$ glassfish-4.1/glassfish/bin/asadmin deploy netbeansprojects/helloear/dist/helloear.ear application deployed name helloear. command deploy executed successfully. thufir@dur:~$ thufir@dur:~$ glassfish-4.1/glassfish/bin/asadmin list-applications helloear <ear, appclient, ejb> command list-applications executed successfully. thufir@dur:~$ thufir@dur:~$ jar -tf netbeansprojects/helloear/dist/helloear.ear meta-inf/ meta-inf/manife

c# - Show List and Submit form on same view in MVC -

Image
i have class name comment follow public class comment { public int id { get; set; } public string name { get; set; } public string coment { get; set; } } what i'm trying , want show list of comments , form add comment on same view(index), have done, far i'm unable hint , index view @model ienumerable<guestbookentryapp.models.comment> <h2>index</h2> <div id="commentlist"> <table> <tr> <th>name</th> <th>comments</th> </tr> @foreach (var obj in model) { <tr> <td>@obj.name</td> <td>@obj.coment</td> </tr> } </table> </div> <br /> <div id="commentbox"> @html.partial("~/views/comments/_addcomment.cshtml", new viewdatadictionary { model = new guestbookentryapp.mod

How to add text and toggle button above listView in android? -

i want add explanatory text , 1 toggle button on top of listview...i referred answers of many similar questions , tried code, mine text , toggle button gets added on top of every item of listview my activity_first_point.xml contain listview follows: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <listview android:id="@+id/list" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="20dp" android:gravity="center" android:background="@drawable/shape" android:drawselectorontop="true" > </listview> <textview andro

How to return specific option type by splitting a string using scala? -

i have following string , want split using scala "myinfo": "name-name;model-model;number-10" i want split value of myinfo string such can access myname , value seperately. e.g. myname:name, model:r210 etc i using following code split string. val data = (mainstring \ "myinfo").as[string].split("\\;").map(_.split("\\-").tolist) .collect { case key :: value :: _ => key -> value }.tomap it gives me desired result. i using data.get("name"),data.get("model"),data.get("number") to access list. gives me results in string type. while want result of data.get("number") in integer format. how result of 'number' in integer format? data.get("number").map(_.toint) will return option[int]

visual studio 2012 - How to show Emoji such as ☔ and &#128546; in a Microsoft MFC CListCtrl? -

i'm developing desktop application mfc clistctrl, build unicode. the listctrl can correctly show !@#$%︿&*() , not emojis ☔ , 😢. it's "virtual listctrl" , lvitem.psztext seems correctly holding in memory unicode "26 14" ☔, not showing correctly. i'm using visual studio 2012 on windows 7. thoughts appreciated. thanks! [edited 20140929] thanks werner henze, have found out "segoe ui symbol" can show emoji correctly in windows 7 http://www.istartedsomething.com/20120818/microsoft-backports-windows-8-emoji-for-segoe-ui-symbol-to-windows-7/ microsoft kb2729094 titled “an update segoe ui symbol font in windows 7 , in windows server 2008 r2 available” presumed made available through windows update soon. however "segoe ui symbol" seems failed on korean characters(which correctly shown "segoe ui"). there few things keep in mind. first program should use registerwindoww , not registerwindowa window instan

html - asp session timeout not working properly -

i want sessions not disappear after default 20 min wrote code <% session("userid")=rsguestbook("userid") session("titleoftheme")=rsguestbook("titleoftheme") session("compare")=rsguestbook("compare") session("thecontect")=rsguestbook("thecontect") session("lastupdate")=rsguestbook("lastupdate") session("requestid")=rsguestbook("requestid") userid=session("userid") session.timeout=600 %> in asp file somehow still 20... <% response.write(session.timeout) %> it shows me 600 correspond 20 i did read few answers here found nun answer why , else missing in code glad quick fix , no don't want use cookies. answer : server side fault or better "recycle pool" make longer clean , sessions hold longer if site low traffic application pool might recycle after 20 minutes. setting higher "idle time out (minutes)

sql server - How can I have a foreign key that points to a computed column? -

i have table: create table [dbo].[question] ( [questionid] int identity (1, 1) not null, [text] nvarchar (4000) null, [questionuid] uniqueidentifier default (newid()) not null, ); i create foreign key linking questionuid in other table admintestquestion questionuid in question table. the referenced table '[dbo].[question]' contains no primary or candidate keys match referencing column list in foreign key. if referenced column computed column, should persisted. any advice appreciated. first of all: not computed column - it's regular column default constraint... for column in table used foreign key reference, must either primary key of table, or has have unique index on it. so here, need add unique index on column create unique index uix_questionuid on dbo.question(questionuid) and should able reference foreign key.