Saturday 15 May 2010

javascript - Call function on polymer navigation drawer panel -



javascript - Call function on polymer navigation drawer panel -

i stuck. playing around polymer not manage phone call togglepanel function on drawer panel , code looks this:

<!doctype html> <html> <head> <!-- 1. load platform.js polyfill support. --> <script src="bower_components/platform/platform.js"></script> <!-- 2. utilize html import bring in element. --> <link rel="import" href="bower_components/core-ajax/core-ajax.html"> <link rel="import" href="bower_components/core-drawer-panel/core-drawer-panel.html"> <link rel="import" href="bower_components/core-toolbar/core-toolbar.html"> <link rel="import" href="bower_components/core-icon-button/core-icon-button.html"> </head> <body> <script> function opendrawer() { alert("fuck"); var drawer = document.getelementbyid("main-drawer"); drawer.togglepanel(); } </script> <core-drawer-panel id="main-drawer"> <div drawer style="background-color: #ff0000;"> </div> <div main style="background-color: #00ff00;"> <core-toolbar style="background-color: #8888ff;"> <core-icon-button icon="menu" onclick="opendrawer()" on-tap="opendrawer()"></core-icon-button> <div flex>pagetitle</div> </core-toolbar> </div> </core-drawer-panel> </body> </html>

the function gets called when click menu button nil more happens, made sure using alert.

i guess has shadow dom not sure. hope knows how phone call function.

core-drawer-panel stays open time if window size less responsivewidth. default remain open unless on tablet device or smaller.

if set responsivewidth high, can alter behavior opens on demand.

<core-drawer-panel id="main-drawer" responsivewidth="900em">

http://jsbin.com/zorufa/2/edit

javascript polymer

Access 2007 doesn't import all element data from XML file -



Access 2007 doesn't import all element data from XML file -

i have xml info need import access farther processing. copied here little part of data:

<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl" href="access question.xsl"?> <catalogue> <app action="a" id="308"> <basevehicle id="67"/> <!-- 1983 porsche 911 --> <bodytype id="9"/> <!-- coupe --> <enginebase id="15"/> <!-- h6 3.0l --> <note>oe sensor technology</note> <qty>1</qty> <parttype id="5132"/> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position id="2172"/> <!-- upstream --> <part>101027</part> </app> <app action="a" id="309"> <basevehicle id="67"/> <!-- 1983 porsche 911 --> <bodytype id="10"/> <!-- convertible --> <enginebase id="15"/> <!-- h6 3.0l --> <note>oe sensor technology</note> <note>for vehicles without start-stop function</note> <qty>1</qty> <parttype id="5132"/> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position id="2172"/> <!-- upstream --> <part>101027</part> </app> <app action="a" id="310"> <basevehicle id="68"/> <!-- 1984 porsche 911 --> <enginebase id="16"/> <!-- h6 3.2l --> <enginevin id="13"/> <!-- b --> <note>oe sensor technology</note> <note>for vehicles without start-stop function</note> <qty>1</qty> <parttype id="5132"/> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position id="2172"/> <!-- upstream --> <part>103918</part> </app> <app action="a" id="311"> <basevehicle id="68"/> <!-- 1984 porsche 911 --> <enginebase id="1778"/> <!-- h6 3.2l --> <aspiration id="5"/> <!-- naturally aspirated --> <qty>1</qty> <parttype id="5132"/> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position id="2172"/> <!-- upstream --> <part>103918</part> </app> </catalogue>

for info utilize xslt:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" indent="yes"/> <xsl:template match="node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="catalogue/app/@*"> <xsl:element name="{name()}"> <xsl:value-of select="."/> </xsl:element> </xsl:template> <xsl:template match="catalogue/app/note[1]"> <note1><xsl:apply-templates select="@*|node()"/></note1> </xsl:template> <xsl:template match="catalogue/app/note[2]"> <note2><xsl:apply-templates select="@*|node()"/></note2> </xsl:template> <xsl:template match="catalogue/app/note[3]"> <note3><xsl:apply-templates select="@*|node()"/></note3> </xsl:template> <xsl:template match="catalogue/app/note[4]"> <note4><xsl:apply-templates select="@*|node()"/></note4> </xsl:template> <xsl:template match="catalogue/app/note[5]"> <note5><xsl:apply-templates select="@*|node()"/></note5> </xsl:template> <xsl:template match="catalogue/app/note[6]"> <note6><xsl:apply-templates select="@*|node()"/></note6> </xsl:template> <xsl:template match="catalogue/app/note[7]"> <note7><xsl:apply-templates select="@*|node()"/></note7> </xsl:template> <xsl:template match="catalogue/app/note[8]"> <note8><xsl:apply-templates select="@*|node()"/></note8> </xsl:template> <xsl:template match="catalogue/app/note[9]"> <note9><xsl:apply-templates select="@*|node()"/></note9> </xsl:template> <xsl:template match="catalogue/app/note[10]"> <note10><xsl:apply-templates select="@*|node()"/></note10> </xsl:template> <xsl:template match="catalogue/app/note[11]"> <note11><xsl:apply-templates select="@*|node()"/></note11> </xsl:template> <xsl:template match="catalogue/app/note[12]"> <note12><xsl:apply-templates select="@*|node()"/></note12> </xsl:template> <xsl:template match="catalogue/app/note[13]"> <note13><xsl:apply-templates select="@*|node()"/></note13> </xsl:template> <xsl:template match="catalogue/app/note[14]"> <note14><xsl:apply-templates select="@*|node()"/></note14> </xsl:template> <xsl:template match="catalogue/app/note[15]"> <note15><xsl:apply-templates select="@*|node()"/></note15> </xsl:template> </xsl:stylesheet>

after tranformation looks this:

<?xml version="1.0" encoding="iso-8859-1"?> <catalogue> <app> <action>a</action> <id>308</id> <basevehicle>67</basevehicle> <!-- 1983 porsche 911 --> <bodytype>9</bodytype> <!-- coupe --> <enginebase>15</enginebase> <!-- h6 3.0l --> <note1>oe sensor technology</note1> <qty>1</qty> <parttype>5132</parttype> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position>2172</position> <!-- upstream --> <part>101027</part> </app> <app> <action>a</action> <id>309</id> <basevehicle>67</basevehicle> <!-- 1983 porsche 911 --> <bodytype>10</bodytype> <!-- convertible --> <enginebase>15</enginebase> <!-- h6 3.0l --> <note1>oe sensor technology</note1> <note2>for vehicles without start-stop function</note2> <qty>1</qty> <parttype>5132</parttype> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position>2172</position> <!-- upstream --> <part>101027</part> </app> <app> <action>a</action> <id>310</id> <basevehicle>68</basevehicle> <!-- 1984 porsche 911 --> <enginebase>16</enginebase> <!-- h6 3.2l --> <enginevin>13</enginevin> <!-- b --> <note1>oe sensor technology</note1> <note2>for vehicles without start-stop function</note2> <qty>1</qty> <parttype>5132</parttype> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position>2172</position> <!-- upstream --> <part>103918</part> </app> <app> <action>a</action> <id>311</id> <basevehicle>68</basevehicle> <!-- 1984 porsche 911 --> <enginebase>1778</enginebase> <!-- h6 3.2l --> <aspiration>5</aspiration> <!-- naturally aspirated --> <qty>1</qty> <parttype>5132</parttype> <!-- oxygen sensor --> <mfrlabel>sensor</mfrlabel> <position>2172</position> <!-- upstream --> <part>103918</part> </app> </catalogue>

the problem when import xml access xslt transformation, elements "aspiration" , "enginevin" aren't imported. when seek import same way excel, works fine. knows why happening access , how solve it? anyway found how solve problem. need add together new app id="0" element names coming in other app-s, aspiration, enginevin, etc... how add together new app id="0" on top of existing data?

xml ms-access xslt import

c# - Inserts to Database During Debugging Does Not Commit To The Actual Database -



c# - Inserts to Database During Debugging Does Not Commit To The Actual Database -

sorry life of me can't figure out, i'm sure must setting within visual basic missing.

so have programme lets me insert values database , datagridview selects values showing me results of inserted records.

when debug programme looks great. inserts , shows in datagridview. problem close programme records disappear. when come in programme 1 time again not there. when examine actual database values didn't commit.

what confuses me working fine yesterday , haven't touched of visual basic settings have no thought causing problem.

thank in advance of help.

edit

so figured out because property of database named "copy output" set "copy always" , setting "copy if newer" fixed problem. seeing visual studio making changes own re-create of database within debug/bin folder. there anyway create commit actual database instead of going around that?

here connection string:

<add name="sa_dbconnectionstring" connectionstring="data source=.\sqlexpress;attachdbfilename=&quot;|datadirectory|\sa db.mdf&quot;;integrated security=true;user instance=true; multipleactiveresultsets=true" providername="system.data.sqlclient" />

c# sql database visual-studio-2010 settings

c# - what is the best practice to exit an WPF application? -



c# - what is the best practice to exit an WPF application? -

i maintaining existing c# application, , noticed next code not working expected.

private void form1_load(object sender, eventargs e){ ... if (proc.length == 0) { proc = process.getprocessesbyname("opcon"); if (proc.length == 0) { writelog("dataloggerservice start: no tss process detected; close;"); this.close(); } } ... }

the code supposed exit after close() api call. however, still proceed.

after reading , research, modified to

private void form1_load(object sender, eventargs e){ .... if (proc.length == 0) { proc = process.getprocessesbyname("opcon"); if (proc.length == 0) { writelog("dataloggerservice start: no tss process detected; close;"); this.dispose(); environment.exit(0); } } .... }

it seems exit expected. however, not confident whether best practice?

is necessary phone call this.close() or this.dispose() before environment.exit()?

thanks.

regards, sqr

in wpf application whenever mainwindow specified startupuri in app.xaml closed application exits automatically.

still if want handle exit of application on end can go below solution.

override onclosing of mainwindow , manually exit/shutdown application.

protected override void onclosing(system.componentmodel.canceleventargs e) { // shutdown application. application.current.shutdown(); // or can go below logic // environment.exit(0); }

c# wpf exit

mysql - Creating a Table in SQL, where each tuple can have mutiple values -



mysql - Creating a Table in SQL, where each tuple can have mutiple values -

i m seek create table using create table in sql, person can work @ multiple places, , place can have multiple person working on it, m trying, m sure not correct

create table ( person char(15), place char(15), salary int)

now since person can work in multiple places, m confused should tuple place has multiple values, if yes. how do in advance

you should create 3 separate tables:

"persons" int id (primary key, auto-increment) varchar username varchar email ... (all other info needed) "places" int id (primary key, auto-increment) varchar name etc.

and 3rd table gives relationship between two:

"person_places" (or place_persons, depends on like) int id (primary key, auto-increment) int place_id (linked id of "places" entry) int person_id (linked id of "persons" entry)

this way, every time person starts working in new place, add together entry "person_places". same thing when leave place, or place goes out of business or whatever, need touch "person_places" table.

also, way, 1 person can work in several places, 1 place can have several people working in it.

mysql sql database create-table

html - How to link between divs in twitter bootstrap -



html - How to link between divs in twitter bootstrap -

i using bootstrap framework create website http://www.keralatravelfriend.com navbars working fine. when link

http://www.keralatravelfriend.com/wayanad#hotels (there div called hotels id) not working. when click in navbar "hotels" fine. to. please help.

i have tried everything

you need triger onclick event on #hotels tab.

$('#link').click(function(){ $('.nav-tabs > .active').next('li').find('#hotels').trigger('click'); });

the problem when link on same page illustration below working ....else if link on page need triger after #id url. in case need use:

$(document).ready(function() { var x = location.hash; $('.nav-tabs > .active').next('li').find(x).trigger('click'); }

html twitter-bootstrap

c - Using fgetc to read words? -



c - Using fgetc to read words? -

i want read text file, character character, , characters , words. implementation:

char c; char* word=""; fp = fopen("text.txt","rt"); { c = (char)fgetc(fp); if(c == ' ' || c == '\n' || c == '\0' || c == '\t') { //wordfunction(word) word = ""; //reset word } else { strcat(word, &c); //keeps track of current word } //characterfunction(c); }while(c != eof); fclose(fp);

however, when seek run programme instantly crashes. there problem setting word ""? if so, should instead?

in word variable initial assignment, you're pointing static string of length 0. when seek write info there, you'll overwrite else , programme brake. need, instead, reserve space words.

where have

char* word="";

use instead

char word[100];

this create space of 100 chars word.

char c; char word[100]; fp = fopen("text.txt","rt"); int index = 0; { c = (char)fgetc(fp); if(c == ' ' || c == '\n' || c == '\0' || c == '\t') { //wordfunction(word) word[0] = 0; //reset word index = 0; } else { word[index++] = c; word[index] = 0; //strcat(word, &c); //keeps track of current word } //characterfunction(c); } while(c != eof); fclose(fp);

c c-strings fgetc

How to parse milliseconds using Data.Time in Haskell -



How to parse milliseconds using Data.Time in Haskell -

i have formatted time strings log file of form "08:14:59,012" , parse them utctime (to able create time difference , comparing operations).

i'm unable find way parse milliseconds. here's have far

import system.locale (defaulttimelocale) import data.time (utctime) import data.time.format (readtime) readhms :: string -> utctime readhms = readtime defaulttimelocale "%h:%m:%s" -- ^^ how parse milis? ""%h:%m:%s,%q" doesn't work test = readhms "08:14:59,012"

please suggest way parse milliseconds test above contains them.

even though there isn't format milliseconds, can utilize format picoseconds %q if scale milliseconds correctly. luckily, can done appending fixed number of zeros, resulting string has 12 characters after comma:

readhms = readtime defaulttimelocale "%h:%m:%s,%q" -- ^^^ -- vvvvvvvvvvvvvvvvvv test = readhms $ "08:14:59,012" ++ replicate 9 '0'

haskell

Updating Phonenumbers in AD via csv with Powershell -



Updating Phonenumbers in AD via csv with Powershell -

please guys, help me out here.

i have created file next command:

get-aduser -filter * -properties samaccountname,distinguishedname,telephonenumber | select-object samaccountname,distinguishedname,telephonenumber,address,city | export-csv c:\shares\testshare\new3.csv -notypeinformation -delimiter ";" -encoding utf8;

this works charm, love of god, cannot manage import again, wanna alter phonenumbers in excel sheet, , insert altered file ad.

basically has robbed me 3 days worth of time already, , client becoming edgy..

edit:

i tried run script posted ansgar wiechers unfortunately got few error messages.

use complementary cmdlets in reverse order:

$csv = 'c:\shares\testshare\modified3.csv' import-csv $csv -delimiter ';' -encoding utf8 | % { get-aduser -identity $_.samaccountname | set-aduser -officephone $_.telephonenumber }

edit: error messages suggest seek assign empty telephone numbers. verify adding next line before get-aduser:

write-output "{0} [{1}]" -f $_.samaccountname, $_.telephonenumber

powershell csv cmdlet

r - Farthest element within limited distance for a sorted vector -



r - Farthest element within limited distance for a sorted vector -

we have sorted vector foo, each element i want find largest j such foo[j]-foo[i] < 10. instance when

foo <- c(1,2,5,7,13,17,25,33,85)

the reply is:

bar <- c(4,4,5,5,6,7,8,8,9)

(for i=1, largest j 4 since foo[4]-foo[1]=7-1<10. hence first item of bar 4).

we can compute bar using for , while loop. looking efficient code in r. ideas?

here's method scale better. using overlapping range joins function foverlaps() data.table version 1.9.4:

require(data.table) ## 1.9.4+ x = data.table(start=foo, end=foo+9l) lookup = data.table(start=foo, end=foo) setkey(lookup) ## order doesn't change, 'foo' sorted foverlaps(x, lookup, mult="last", which=true) # [1] 4 4 5 5 6 7 8 8 9

timing on 100,000 numbers:

set.seed(45l) foo <- sort(sample(1e6, 1e5, false)) arun <- function(foo) { x = data.table(start=foo, end=foo+9l) lookup = data.table(start=foo, end=foo) setkey(lookup) foverlaps(x, lookup, mult="last", which=true) } system.time(arun(foo)) # user scheme elapsed # 0.142 0.009 0.153

r vector

groovy - grails command line application -



groovy - grails command line application -

i have grails web application domain model , hibernate datasource persistence.

i write command line tool in groovy access domain model , hibernate datasource.

any ideas how can this?

regards vanigor

you can utilize spring boot described in this article.

that illustration creates little web ui, boot can configured cli app.

grails groovy

c# - Search first N sorted integers from an unsorted array length M? -



c# - Search first N sorted integers from an unsorted array length M? -

failed interview on algorithm question how search first n minimum/maximum ordered integers unsorted integer array size m days ago.

from perspective, search problems can converted solved binary search tree info construction has log2n time complexity or extension such b+ tree.

for problem, build binary search tree @ first , search n count afterwards. therefore, complexity should

consumed in building tree : m * log2 m + consumed in searching tree : n * log2 m total : = (m + n) log2 m

i can't find improve solution, post code here , sincerely hope guys have improve one. code casual works. point out idea.

using system; using system.collections.generic; using system.linq; using system.text; namespace searchfirstnfromm { class programme { static void main(string[] args) { int[] m = new int[10000]; //input m - int array int n = 10; //input n - int console.writeline("integer array"); random rd = new random(); (int = 0; < m.length; i++) { m[i] = rd.next(0, m.length); console.write(m[i] + " "); } console.writeline(); console.writeline(); node root = buildbinarysearchtree(m); //building binary search tree console.writeline("first n in ordered tree"); console.write("expected result : "); m.orderby(t => t).take(n_counter).tolist().foreach(t => console.write(t + " ")); console.writeline(); console.write("actual result : "); displayfirstn(root); console.writeline(); console.writeline(); n_counter = n; //counter reset console.writeline("last n in ordered tree"); console.write("expected result : "); m.orderbydescending(t => t).take(n_counter).tolist().foreach(t => console.write(t + " ")); console.writeline(); console.write("actual result : "); displaylastn(root); console.writeline(); console.readkey(); } static int n_counter = 10; static void displayfirstn(node root) { if (root != null) { if (root.left != null) displayfirstn(root.left); if (n_counter-- > 0) console.write(root.data + " "); if (root.right != null) displayfirstn(root.right); } } static void displaylastn(node root) { if (root != null) { if (root.right != null) displaylastn(root.right); if (n_counter-- > 0) console.write(root.data + " "); if (root.left != null) displaylastn(root.left); } } static void displaytree(node current) { if (current != null) { if (current.left != null) displaytree(current.left); console.write(current.data + " "); if (current.right != null) displaytree(current.right); } } static node buildbinarysearchtree(int[] m) { node root = new node(m[0]); (int = 1; < m.length; i++) { node current = root; while (true) { if (m[i] >= current.data) { if (current.right == null) { var newnode = new node(m[i]); newnode.parent = current; current.right = newnode; break; } current = current.right; } else { if (current.left == null) { var newnode = new node(m[i]); newnode.parent = current; current.left = newnode; break; } current = current.left; } } } homecoming root; } class node { public node(int data) { this.data = data; } public node parent { get; set; } public node left { get; set; } public node right { get; set; } public int info { get; set; } } } }

a improve , relatively simple way solve utilize a heap info structure. algorithm be:

for first n elements, insert heap (o[log n]). each of remaining m-n elements, compare minimum value in heap (o1). if greater, delete smallest heap value , insert heap (o[log n]). lastly, generate sorted list heap (o[n log n]).

total complexity: m log n + n log n. if m much bigger n, win on m log m sort.

c# arrays algorithm data-structures binary-search-tree

ios - UIStatusBar become red after using AVAssetExportSession for UIImagePickerController media conversion -



ios - UIStatusBar become red after using AVAssetExportSession for UIImagePickerController media conversion -

i converting .mov video uiimagepickercontroller .mp4 format using avassetexportsession. 1 time conversion completed send info server. works fine, except status bar become reddish , pulsing after transmission completed. if set app in background , open again, status bar returns normal status again.

this think piece of code causes behavior:

//i took video __block nsstring *messagetype; __block nsdata *messagedata; __block nsstring *messagetext; [...] nsurl *url = [info objectforkey:uiimagepickercontrollermediaurl]; avurlasset *avasset = [avurlasset urlassetwithurl:url options:nil]; nsarray *compatiblepresets = [avassetexportsession exportpresetscompatiblewithasset:avasset]; nsstring *videopath = nil; if ([compatiblepresets containsobject:avassetexportpresetlowquality]) { avassetexportsession *exportsession = [[avassetexportsession alloc]initwithasset:avasset presetname:avassetexportpresetpassthrough]; videopath = [[nstemporarydirectory() stringbyappendingpathcomponent:videodirectory]stringbyappendingpathcomponent:tempvideofilename]; exportsession.outputurl = [nsurl fileurlwithpath:videopath]; nslog(@"videopath of mp4 file = %@",videopath); // path of .mp4 file exportsession.outputfiletype = avfiletypempeg4; [exportsession exportasynchronouslywithcompletionhandler:^{ switch ([exportsession status]) { case avassetexportsessionstatusfailed:{ nslog(@"export failed: %@", [[exportsession error] localizeddescription]); [picker dismissviewcontrolleranimated:yes completion:^{ [svprogresshud showerrorwithstatus:[[exportsession error] localizeddescription]]; }]; } break; case avassetexportsessionstatuscancelled: nslog(@"export canceled"); break; case avassetexportsessionstatuscompleted:{ messagedata = [nsdata datawithcontentsofurl:[nsurl fileurlwithpath:videopath]]; messagetext = videopath; messagetype = kmessagetypevideo; // method sends asynchronously info server [self sendmediatype:messagetype messagedata:messagedata messagetext:messagetext]; [picker dismissviewcontrolleranimated:yes completion:null]; } break; default: break; } }]; }

is there way avoid appearance of reddish status bar or @ to the lowest degree way should utilize create disappear?

it turns out in way recording session of uiimagepickercontroller went in conflict avassetexportsession.

i resolved issue converting video after having dismissed uiimagepicker controller:

-(void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info{ nsstring *mediatype = [info objectforkey: uiimagepickercontrollermediatype]; if (cfstringcompare ((__bridge_retained cfstringref) mediatype, kuttypeimage, 0) == kcfcompareequalto) { [....] } else{ //took video nsurl *url = [info objectforkey:uiimagepickercontrollermediaurl]; [picker dismissviewcontrolleranimated:yes completion:^{ [self convertandsendvideo:url]; }]; } } -(void)convertandsendvideo:(nsurl *)url{ __block nsstring *messagetype; __block nsdata *messagedata; __block nsstring *messagetext; avurlasset *avasset = [avurlasset urlassetwithurl:url options:nil]; nsarray *compatiblepresets = [avassetexportsession exportpresetscompatiblewithasset:avasset]; nsstring *videopath = nil; if ([compatiblepresets containsobject:avassetexportpresetlowquality]) { __block avassetexportsession *exportsession = [[avassetexportsession alloc]initwithasset:avasset presetname:avassetexportpresetpassthrough]; videopath = [[nstemporarydirectory() stringbyappendingpathcomponent:videodirectory]stringbyappendingpathcomponent:tempvideofilename]; exportsession.outputurl = [nsurl fileurlwithpath:videopath]; nslog(@"videopath of mp4 file = %@",videopath); // path of .mp4 file exportsession.outputfiletype = avfiletypempeg4; [exportsession exportasynchronouslywithcompletionhandler:^{ switch ([exportsession status]) { case avassetexportsessionstatusfailed:{ nslog(@"export failed: %@", [[exportsession error] localizeddescription]); [svprogresshud showerrorwithstatus:[[exportsession error] localizeddescription]]; } break; case avassetexportsessionstatuscancelled: nslog(@"export canceled"); break; case avassetexportsessionstatuscompleted:{ messagedata = [nsdata datawithcontentsofurl:[nsurl fileurlwithpath:videopath]]; messagetext = videopath; messagetype = kmessagetypevideo; [self sendmediatype:messagetype messagedata:messagedata messagetext:messagetext]; } break; default: break; } }]; } }

ios objective-c uiimagepickercontroller uistatusbar avassetexportsession

arrays - AS3 How to add multiple user input in a textfield -



arrays - AS3 How to add multiple user input in a textfield -

i have movieclip called (ps1) input textfields within i.e.( name, address, phone number... etc)

and have textfield box called (newtext) receive user input input textfields.

1.how can save multiple user inputs newtext?

thank you

you can that:

name.addeventlistener(event.change, onupdate); address.addeventlistener(event.change, onupdate); phone.addeventlistener(event.change, onupdate); function onupdate(e:event):void { newtext.text = "name: " + name.text + " adress: " + address.text + " phone: " + phone.text; }

arrays actionscript-3 text input

string - Function to delete all occurrences of a word in a sentence in C -



string - Function to delete all occurrences of a word in a sentence in C -

i have code remove first occurrence of word sentence:

#include "stdio.h" #include "string.h" int delete(char *source, char *word); void main(void) { char sentence[500]; char word[30]; printf("please come in sentence. max 499 chars. \n"); fgets(sentence, 500, stdin); printf("please come in word deleted sentence. max 29 chars. \n"); scanf("%s", word); delete(sentence, word); printf("%s", sentence); } int delete(char *source, char *word) { char *p; char temp[500], temp2[500]; if(!(p = strstr(source, word))) { printf("word not found in sentence.\n"); homecoming 0; } strcpy(temp, source); temp[p - source] = '\0'; strcpy(temp2, p + strlen(word)); strcat(temp, temp2); strcpy(source, temp); homecoming 1; }

how modify delete occurrences of word in given sentence? can still utilize strstr function in case?

thanks help!

open different ways of doing too.

p.s. might sound homework question, it's past midterm question i'd resolve prepare midterm!

as side question, if utilize fgets(word, 30, stdin) instead of scanf("%s", word), no longer works , tells me word not found in sentence. why?

how modify to delete occurrences of word in given sentence?

there many ways, have suggested, , since open different ways of doing too... here different idea: sentence uses white space separate words. can utilize help solve problem. consider implementing these steps using fgets(), strtok() , strcat() break apart string, , reassemble without string remove.

0) create line buffer sufficient length read lines file (or pass in line buffer argument) 1) utilize while(fgets(...) new line file 2) create char *buf={0}; 3) create char *new_str; (calloc() memory new_str >= length of line buffer) 4) loop on buf = strtok();, using " \t\n" delimiter within loop: a. if (strcmp(buf, str_to_remove) != 0) //approve next token concatenation { strcat(new_str, buf); strcat(new_str, " ");}//if not str_to_remove, //concatenate token, , space 5) free allocated memory

new_str contains sentence without occurrences of str_to_remove.

here demo using set of steps (pretty much)

int delete(char *str, char *str_to_remove) { char *buf; char *new_str; new_str = calloc(strlen(str)+1, sizeof(char)); buf = strtok(str, " \t\n"); while(buf) { if(strcmp(buf, str_to_remove) != 0) { strcat(new_str, buf); strcat(new_str, " "); } buf = strtok(null, " \t\n"); } printf("%s\n", new_str); free(new_str); getchar(); homecoming 0; } int main(void) { delete("this sentence had withh bad withh word", "withh"); homecoming 0; }

c string

http - Laravel Overwrite Route::Resource to Alternate Method -



http - Laravel Overwrite Route::Resource to Alternate Method -

currently working on laravel project. route i'm working defined resource, i'd alter post utilize updateticket() instead of store(). how overwrite post route of defined resource?

the simplest solution phone call updateticket() in store()

public function store(){ homecoming $this->updateticket(); }

http laravel laravel-routing

pip - How to do Python package management? -



pip - How to do Python package management? -

coming node.js + npm background, nightmarish trying understand things related python bundle management. after few hours of research, i've stumbled upon keywords:

easy_install virtualenv pip setuptools distutils pypi wheel egg site-packages

can help me decipher terms , set them in historical context? example, "distutils first bundle manager superseded x in y because z".

i absolutely love python (the language) bundle management seems real nightmare larn has been using amazing npm lastly few years.

types of packages egg vs wheel vs neither. what's meant neither python bundle can installed "source" without beingness packaged egg or wheel.

packaging utilities there several libraries provide utilities packaging python applications, including distutils , setuptools. there excellent post on this.

easy_install part of setuptools, allows building , installing python packages. discouraged in favor of pip. designed create installation of packages easy, doing chore of downloading , moving them right place (hence name).

pip bundle manager python packages, , replacement easy_install! see here reasons why people prefer on easy_install. can neat things install bundle straight git repository or compile c extensions on target machine. latter debatable whether or not it's desirable, nonetheless it's nice feature have if want it.

pypi python bundle index, easy_install , pip search available packages, default. giant online repository of modules accepted community.

virtualenv way of hacking environment variables "isolate" installation of python , it's related modules. prefers pip, because ian bicking wrote them both. basically, utilize pip install virtualenv scheme wide, allows create python virtual environments, each own re-create of python, pip, , assorted modules. lets have multiple versions of python or install module testing, without mucking system-wide python install.

virtualenvwrapper handy shell script makes creating , tearing downwards virtual environments easier.

site-packages 1 of supported locations installing python modules into. lives someplace /usr/lib/pythonx.x/site-packages. there other supported locations, dist-packages or user specific locations.

what mean you? i'd recommend don't pay attending easy_install , utilize pip. please utilize virtualenv. usually, python modules should install system-wide on workstation pip , virtualenv. i've ignored eggs , wheels, if plan distribute packages professionally or host them on pypi, want investigate those. also, if creating python packages, need learn write setup script, setuptools. recommendation never utilize distutils.

some more reading a page on python.org packaging covers lot of these topics python packaging is nightmare a great post goes against mutual recommendations, including mine!

python pip virtualenv

html - Bootstrap - How to center div that has text inside it? -



html - Bootstrap - How to center div that has text inside it? -

i want able center div contains text below in middle of page. though able utilize 'center-block' class in bootstrap doesn't seem work:

live preview: http://codepen.io/anon/pen/tcilg

code below: <div class="row"> <div class="col-md-4 center-block text-center"> want center div text in.i want center div text in.i want center div text in.i want center div text in.i want center div text in.i want center div text in.i want center div text in.i want center div text in.i want center div text in.i want center div text in. </div> </div>

the .col-md-4 class causing float left instead of center. if want maintain width class, can override in css:

.col-md-4.center-block { float: none; }

updated codepen: http://codepen.io/sdsanders/pen/lhrvu

html css twitter-bootstrap

PHP calls to git command via system(), fails with exit code 128 -



PHP calls to git command via system(), fails with exit code 128 -

centos 5.9, php 5.4.21, tomcat 7.0.42, safe mode off.

i need commit code repository php. failed exit code 128. codes below, , command_exec 'cd /data/project && git add together .'

ob_start(); $this->system_call_detail = system($this->command_exec, $this->output); $logger->debug('executecmd scheme phone call result : '.$this->system_call_detail); ob_end_clean();

i can run git command apache user business relationship cmd, programs run php fail exit code 128.

i guessed cause php. so, tried git command, "php -r 'system("cd /data/project && git add together .", $test); echo $test;'" cmd apache user business relationship , success.

i solved problem..

first, couldn't contents when run command, because of php bug(?). http://kr1.php.net/manual/en/function.system.php#108713

i fixed command belows:

$this->system_call_detail = system($this->command_exec.' 2>&1', $this->output);

and then, error msgs belows:

fatal: unable access '/home/{username}/.config/git/config': permission denied

but, there no such files or directory. so, googled error msgs. , found blog.

http://www.jethrocarr.com/2013/08/25/the-apache-that-wanted-to-be-root/

and edited '/etc/sysconfig/httpd' file blogs posted. , solved. :)

thank helping me. deceze , ojrask

php git

swift - iOS8 Retina @2x images not scaling like iOS7? -



swift - iOS8 Retina @2x images not scaling like iOS7? -

has way xcode 6.1 (ios 8.1) changed way images handled. in previous sprite kit game (xcode 5, ios 7) used next total screen image background:

mainbackground_ip5@2x.png // resolution: 640 x 1136, fills screen.

now in xcode 6.1 testing next code (see below), image using is:

mainbackground_ip6@2x.png // resolution: 750 x 1334

code:

func setupbackdrop() { println(__function__) allow backdropsprite = skspritenode(imagenamed: "mainbackground_ip6") backdropsprite.anchorpoint = cgpointzero backdropsprite.position = cgpointzero self.addchild(backdropsprite) }

however when run application both on simulator , device following.

note: if remove @2x fits fine, can,t understand whats changed, have not seen mentioned in sprite kit notes? loaded old iphone 5 game project , @2x backgrounds fit in that, must ios 8.

images should utilize @2x problem in gamescene.sks had entered screen resolution in pixels not points (should have been 375 x 667) there seems problem gamescene.sks on template, if add together items programatically did quite don't display. solution seems have add together @ to the lowest degree 1 node gamescene.sks (i added empty sknode)

swift ios8 sprite-kit

database - yii2 rbac check for role user->can() -



database - yii2 rbac check for role user->can() -

i installed , configured rbac in yii2 dbmanager don't "check" working with:

if (yii::$app->user->can('waitaccess')) { echo "yes pending."; } else { echo "nothing"; }

i made 3 users different roles each of them able see first line despite don't have permission. "in opinion"

this here rbaccontroller

<?php namespace console\controllers; utilize yii; utilize yii\console\controller; class rbaccontroller extends controller { public function actioninit() { $auth = yii::$app->authmanager; // add together "user2view" permission $user2view = $auth->createpermission('user2view'); $user2view->description = 'user2 view'; $auth->add($user2view); // add together "user1view" permission $user1view = $auth->createpermission('user1view'); $user1view->description = 'user1 view'; $auth->add($user1view); // add together "waitaccess" permission $waitaccess = $auth->createpermission('waitaccess'); $waitaccess->description = 'wait access'; $auth->add($waitaccess); // add together "seeconfig" permission $seeconfig = $auth->createpermission('seeconfig'); $seeconfig->description = 'access administrative config'; $auth->add($seeconfig); // add together "user2" role , give role "user2view" permission $user2 = $auth->createrole('user2'); $auth->add($user2); $auth->addchild($user2, $user2view); // add together "user1" role , give role "user1view" permission $user1 = $auth->createrole('user1'); $auth->add($user1); $auth->addchild($user1, $user1view); // add together "pending" role , give role "waitaccess" permission $pending = $auth->createrole('pending'); $auth->add($pending); $auth->addchild($pending, $waitaccess); // add together "superadmin" role , give role "seeconfig" permission $superadmin = $auth->createrole('superadmin'); $auth->add($superadmin); $auth->addchild($superadmin, $seeconfig); $auth->addchild($superadmin, $user2view); $auth->addchild($superadmin, $user1view); $auth->addchild($superadmin, $waitaccess); } }

maybe have clue can for.

update: db construction

update 2:

i solved it! stupidity didn't took on default rules users written down. had access. deleting line , adding pending standard resolved it.

database user yii2 rbac

php - Nginx --> Upload file = Error (need rewrite) -



php - Nginx --> Upload file = Error (need rewrite) -

i'm using xenforo , there little problem - can't upload files /var/www/internal_data/attachments/0;

it's chmod'ed 0777'. don't know, tried utilize rewrite, still i'm getting upload error.

here default file of nginx configuration:

server { hear 80; hear [::]:80 default ipv6only=on; server_name domain www.domain.com; root /var/www; index index.html index.htm index.php; location / { try_files $uri $uri/ =404; } error_page 403 404 405 /40x.html; location /40x.html { root /somepath; internal; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /somepath; internal; } location ~ \.php$ { root /var/www; index index.php; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } location ~ /\.ht { deny all; } } client_max_body_size 50m; #post urln location /var/www/ { # pass altered request body location upload_pass @after_upload; # store files directory upload_store /var/www/internal_data/attachments/0; # allow uploaded files read user upload_store_access user:rw; # set specified fields in request body upload_set_form_field $upload_field_name.name “$upload_file_name”; upload_set_form_field $upload_field_name.content_type “$upload_content_type”; upload_set_form_field $upload_field_name.path “$upload_tmp_path”; # inform backend hash , size of file upload_aggregate_form_field “$upload_field_name.md5” “$upload_file_md5”; upload_aggregate_form_field “$upload_field_name.size” “$upload_file_size”; #upload_pass_form_field “some_hidden_field_i_care_about”; upload_cleanup 400 404 499 500-505; } location / { root /var/www; } location @after_upload { proxy_pass http://127.0.0.1:8888; } } }

what's wrong there? answers.

php file-upload nginx helpers

java - Trouble writing a method that takes a string and returns an array of chars -



java - Trouble writing a method that takes a string and returns an array of chars -

i'm new java , stuck on code below. don't know how homecoming char array; , if alter string "purple" else, java won't compile code.

public class assigment4 { public static void main(string[] args) { // error if color initialized longer or shorter string. string color = "purple"; char[] = turnstringtochar(color); system.out.println(a); } public static char[] turnstringtochar(string color) { char[] letters = {'p', 'u', 'r', 'p', 'l', 'e'}; (int = 0; < color.length(); i++) { // part stuck. don't know return. letters[i] = color.charat(i); } homecoming letters; } }

can help me?

on turnstringtochar method, need declare letters character array in such way length dependent on length of color variable. if have input longer "purple"; e.g: "yellowwwww"; programme not throw errors.

//this talking char[] letters = new char[color.length()]; (int = 0; < color.length(); i++) { // okay! letters[i] = color.charat(i); }

note: understand assignment , have implement own implementation, future use, can utilize tochararray() method string class. usage: color.tochararray()

java arrays string char

How to add back button in maps app for windows store apps (Javascript) -



How to add back button in maps app for windows store apps (Javascript) -

in maps app want add together button in goes in navigation stack. tried creating button element , adding map using map.entities.push , adding click event it, dint work. should add together map overlay or something. doing wrong.

javascript windows-runtime windows-store-apps winjs windows-applications

eclipse - Java code - area of a polygon -



eclipse - Java code - area of a polygon -

i have code no compile errors, after come in sec number while running crashes on me :(

heres have:

import java.util.scanner; public class assignment536 { public static void main(string[] args) { scanner input = new scanner(system.in); system.out.println("enter number of sides: "); int numberofsides = input.nextint(); system.out.println("enter side: "); double side = input.nextint(); system.out.println("the area of polygon is: " +area(numberofsides, side)); input.close(); } public static double area(int n, double side) { double reply = (n*(side*side))*(4*(math.tan((math.pi*n)))); homecoming answer; } }

any help appreciated! give thanks you, sebastian

you should change:

final double side = input.nextint();

for

final double side = input.nextdouble();

if want read double.

java eclipse methods polygon area

linux - Renamea file with new suffix -



linux - Renamea file with new suffix -

how can rename file eith new suffix known prefix ?

example:

i have file called: a_proof.txt

how can rename in: a_proof.tmp

i have utilize linux shell csh , ksh, , used programs on linux reddish hat.

without using bash features can utilize basename:

mv a_proof.txt `basename 'a_proof.txt' '.txt'`.tmp

linux shell redhat

Java Apache Commons Math, linear least squares (fitting) with constraints -



Java Apache Commons Math, linear least squares (fitting) with constraints -

i'm trying utilize apache commons math library in java (latest version) solve linear to the lowest degree squares problem, there constraint on solution.

specifically, want solution contain positive values. in other words, want find best fit of basis functions such solution weights greater 0.

if has tracked particular problem downwards , solved it, grateful solution!

java apache-commons curve-fitting linear-regression least-squares

algorithm - Is there a standard approach to find related/similar objects? -



algorithm - Is there a standard approach to find related/similar objects? -

suppose have set of entities (for illustration people physical characteristics) , want find, given entity x, entities related (or similar) it, definition of similarity.

i can find such entities 1 dimension (all people height y ~= x's height within threshold) there approach can utilize find similar entities considering more 1 attribute?

it going depend on define similarity, can utilize same approach take 1d, dimension, little generalization. assuming each element represented vector, can measure distance of 2 vectors x,y d=|x-y|, , accept/reject depending on d , threshold.

in here, minus operator vector negation: (a1,a2,...,an)-(b1,b2,...,bn)=(a1-b1,a2-b2,...,an-bn) and absolute value 1 time again vectors: |(a1,a2,...,an)| = sqrt(a1^2 + a2^2 + ... + an^2).

it easy see generalization of 1d example, , invoking same approach vectors single element same.

downside of approach (0,0,0,...,0,10^20) , (0,0,0,....,0) far away each other - might or might not after, , might need different distance metric - depends on after.

algorithm similarity correlated

if statement - Java, BufferedReader, restrict user input, y/n -



if statement - Java, BufferedReader, restrict user input, y/n -

my question how restrict user input y/n or y/n(in java). i'm using equals() , plan alter them equalsignorecase(), should take care of case part. however, doesn't stop user entering other characters(ex: h or h). when character besides y or n entered programme proceeds straight "thanks playing message" , end of game.

i relatively new programming, please provide examples suggestion, preferably finish example. goes long way me. additional, if sense section of code written in improve way, open rewrites, 1 time 1 time again please provide total example.

i realize question little broad stackoverflow utilize insight of more experienced programs. give thanks time.

// creates instance of bufferedreader // prompts user play game 1 time again // places user input in seek // if user wants play again, phone call startgame() // if user dosen't want play again, maintain asking anyways private void showplayagainmessage() { bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); system.out.println(); system.out.println("do want play again? (y/n)"); seek { string playagain = br.readline(); // want play again? y. if(playagain.equals("y")) { startgame();//else prompt question if else } // want play again? n. else if(playagain.equals("n")) { system.out.println(); system.out.println("last chance. play again? (y/n)"); playagain = br.readline(); // lastly chance. play again? y. if(playagain.equals("y")) { startgame(); } // lastly chance. play again? n. else if(playagain.equals("n")) { system.out.println(); system.out.println("how minesweeper? (y/n)"); playagain = br.readline(); // how minesweeper? y. if(playagain.equals("y")) { system.out.println(); system.out.println("i wish had minesweeper..."); system.out.println("lots of hangman though...hangman? (y/n)"); playagain = br.readline(); // lots of hangman though...hangman? y. if(playagain.equals("y")) { startgame(); } // lots of hangman though...hangman? n. else if (playagain.equals("n")) { system.out.println(); system.out.println("ok..."); } } } } }

this string of question looks annoying, if must, can utilize while loop switch statement implements state machine.

int state = 0; while (state < 4) { switch (state) { case 0: system.out.println("do want play again? (y/n)"); break; case 1: system.out.println("last chance. play again? (y/n)"); break; case 2: system.out.println("how minesweeper? (y/n)"); break; case 3: system.out.println("i wish had minesweeper..."); system.out.println("lots of hangman though...hangman? (y/n)");break; } string playagain = br.readline(); if(playagain.equals("y")) { startgame(); state = 0; } else if(playagain.equals("n")) { state++; } } system.out.println("ok...");

each "n" reply advance next question. illegal input show current question again.

java if-statement bufferedreader nested-if

Text gets squashed when re-sizing web browser HTML | CSS -



Text gets squashed when re-sizing web browser HTML | CSS -

the text on website not re-size correctly when making browser window smalller. squashes text in middle , makes more lines. here code

my whole document

html: http://pastebin.com/kj1jvtjv css:http://pastebin.com/a1cp7viq

html:

</div> <div id="newsposts"> <p>toontown classic coming soon</p> </div>

css:

#newsposts{ position: relative; bottom: 0px; top: -925px; width: 45%; position: center; margin: 0 auto; font-size: 20px; margin-left: 10; margin-right: 10; text-indent: 5; }

i can't tell how want work question. if want font-size dynamically alter based on view size of browser, utilize vw units (see jsfiddle preview , code illustration below).

try this: http://jsfiddle.net/km1hbpzv/1/ seek resizing browser see if effect want.

i worked off of html , css posted on pastebin, added in css original post , edited it.

my changes:

#newsposts { position: relative; bottom: 0px; top: -925px; width: 45%; //position: center; changed text-align: center (below) text-align: center; margin: 0 auto; //font-size: 20px; changed 2vw percentage of viewport width font-size: 2vw; margin-left: 10; margin-right: 10; text-indent: 5; } #dateandby { position: relative; bottom: 0px; top: -930px; //font-size: 30px; changed 3vw percentage of viewport width font-size: 3vw; margin-left: 10; margin-right: 10; text-indent: 5; }

there may structural problems html create later styling changes harder implement, seems work @ moment based on info collect post.

further give-and-take related vw units , other font-size practices may found here: pure css create font-size responsive based on dynamic amount of characters

html css

javascript - Show/Hide Table Rows based on Checkbox -



javascript - Show/Hide Table Rows based on Checkbox -

i trying show or hide 3 table rows based on 1 check box. 3 table rows should hide in first place. should show when user has checked box. have seen other people's work , tried doing it.

however, not working in web page. on top of that, 3 table rows shown when page loaded. should hidden in first place , shown when visit checkbox has been checked.

i have tried placing js codes @ top or bottom of web page.

here's link: http://jsfiddle.net/pbtbs/22/

my html page

<table> <tr> <td class="label">visit</td> <td><input type="checkbox" name="visit" id="visit" onclick="showhide()" /></td> </tr> <tr id="visitdate"> <td class="label">visit date</td> <td><select name="day" class="label" id="day"> <option value="" selected="selected">day</option> <option value="01">1</option> <option value="02">2</option> <option value="03">3</option> <option value="04">4</option> <option value="05">5</option> <option value="06">6</option> <option value="07">7</option> <option value="08">8</option> <option value="09">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select name="month" class="label" id="month"> <option value="" selected="selected">month</option> <option value="01">january</option> <option value="02">february</option> <option value="03">march</option> <option value="04">april</option> <option value="05">may</option> <option value="06">june</option> <option value="07">july</option> <option value="08">august</option> <option value="09">september</option> <option value="10">october</option> <option value="11">november</option> <option value="12">december</option> </select> <select name="year" class="label" id="year"> <option value="" selected="selected">year</option> <option value="2014">2014</option> </select></td> </tr> <tr id="visitstime"> <td class="label">start time</td> <td><select name="hr" class="label" id="hr"> <option value="" selected="selected">hh</option> <option value="00">00</option> <option value="01">01</option> <option value="02">02</option> <option value="03">03</option> <option value="04">04</option> <option value="05">05</option> <option value="06">06</option> <option value="07">07</option> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> </select> : <select name="min" class="label" id="min"> <option value="" selected="selected">mm</option> <option value="01">01</option> <option value="02">02</option> <option value="03">03</option> <option value="04">04</option> <option value="05">05</option> <option value="06">06</option> <option value="07">07</option> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> <option value="32">32</option> <option value="33">33</option> <option value="34">34</option> <option value="35">35</option> <option value="36">36</option> <option value="37">37</option> <option value="38">38</option> <option value="39">39</option> <option value="40">40</option> <option value="41">41</option> <option value="42">42</option> <option value="43">43</option> <option value="44">44</option> <option value="45">45</option> <option value="46">46</option> <option value="47">47</option> <option value="48">48</option> <option value="49">49</option> <option value="50">50</option> <option value="51">51</option> <option value="52">52</option> <option value="53">53</option> <option value="54">54</option> <option value="55">55</option> <option value="56">56</option> <option value="57">57</option> <option value="58">58</option> <option value="59">59</option> <option value="60">60</option> </select> : <select name="sec" class="label" id="sec"> <option value="" selected="selected">ss</option> <option value="01">01</option> <option value="02">02</option> <option value="03">03</option> <option value="04">04</option> <option value="05">05</option> <option value="06">06</option> <option value="07">07</option> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> <option value="32">32</option> <option value="33">33</option> <option value="34">34</option> <option value="35">35</option> <option value="36">36</option> <option value="37">37</option> <option value="38">38</option> <option value="39">39</option> <option value="40">40</option> <option value="41">41</option> <option value="42">42</option> <option value="43">43</option> <option value="44">44</option> <option value="45">45</option> <option value="46">46</option> <option value="47">47</option> <option value="48">48</option> <option value="49">49</option> <option value="50">50</option> <option value="51">51</option> <option value="52">52</option> <option value="53">53</option> <option value="54">54</option> <option value="55">55</option> <option value="56">56</option> <option value="57">57</option> <option value="58">58</option> <option value="59">59</option> <option value="60">60</option> </select></td> </tr> <tr id="visitetime"> <td class="label">end time</td> <td><select name="hr2" class="label" id="hr2"> <option value="" selected="selected">hh</option> <option value="00">00</option> <option value="01">01</option> <option value="02">02</option> <option value="03">03</option> <option value="04">04</option> <option value="05">05</option> <option value="06">06</option> <option value="07">07</option> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> </select> : <select name="min2" class="label" id="min2"> <option value="" selected="selected">mm</option> <option value="01">01</option> <option value="02">02</option> <option value="03">03</option> <option value="04">04</option> <option value="05">05</option> <option value="06">06</option> <option value="07">07</option> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> <option value="32">32</option> <option value="33">33</option> <option value="34">34</option> <option value="35">35</option> <option value="36">36</option> <option value="37">37</option> <option value="38">38</option> <option value="39">39</option> <option value="40">40</option> <option value="41">41</option> <option value="42">42</option> <option value="43">43</option> <option value="44">44</option> <option value="45">45</option> <option value="46">46</option> <option value="47">47</option> <option value="48">48</option> <option value="49">49</option> <option value="50">50</option> <option value="51">51</option> <option value="52">52</option> <option value="53">53</option> <option value="54">54</option> <option value="55">55</option> <option value="56">56</option> <option value="57">57</option> <option value="58">58</option> <option value="59">59</option> <option value="60">60</option> </select> : <select name="sec2" class="label" id="sec2"> <option value="" selected="selected">ss</option> <option value="01">01</option> <option value="02">02</option> <option value="03">03</option> <option value="04">04</option> <option value="05">05</option> <option value="06">06</option> <option value="07">07</option> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> <option value="32">32</option> <option value="33">33</option> <option value="34">34</option> <option value="35">35</option> <option value="36">36</option> <option value="37">37</option> <option value="38">38</option> <option value="39">39</option> <option value="40">40</option> <option value="41">41</option> <option value="42">42</option> <option value="43">43</option> <option value="44">44</option> <option value="45">45</option> <option value="46">46</option> <option value="47">47</option> <option value="48">48</option> <option value="49">49</option> <option value="50">50</option> <option value="51">51</option> <option value="52">52</option> <option value="53">53</option> <option value="54">54</option> <option value="55">55</option> <option value="56">56</option> <option value="57">57</option> <option value="58">58</option> <option value="59">59</option> <option value="60">60</option> </select></td> </tr>

javascript codings

function showhide() { $(document).ready(function () { $('#visit').on('change', function(){ if ($(this).prop('checked')) { $('#visitdate').show(); $('#visitstime').show(); $('#visitetime').show(); } else { $('#visitdate').hide(); $('#visitstime').hide(); $('#visitetime').hide(); } }); }); }

try add:

$('#visit').change();

after binding $("#visit") alter event in $(document).ready().

edit

in addition, don't write $(document).ready() within function. must work.

javascript html

asp.net - How bad is it to run an entire HTTP action method in separate thread using Task::Run()? -



asp.net - How bad is it to run an entire HTTP action method in separate thread using Task::Run()? -

i'm writing web services in c++/cli (not choice) using microsoft's web api. lot of functions in web api async, because i'm using c++/cli, don't async/await back upwards of c# or vb. fallback position utilize continuewith() schedule continuation delegate reading async task's result safely.

however, because c++/cli doesn't back upwards inline anonymous delegates or managed lambdas, every delegate continuation must written separate function somewhere. turns spaghetti number of async functions in web api.

so, avoid deadlock issues of task<t>::result, i've been trying this:

[httpget, route( "get/some/dto" )] task< somedto ^ > ^ myactionmethod() { homecoming task::run( gcnew func< somedto ^ >( this, &mycontroller::myactionmethod2 ) ); } somedto ^ myactionmethod2() { // execute code , utilize task->result calls need without deadlocking }

okay, know isn't great, how bad it? don't yet understand plenty of guts of web api or asp.net comprehend performance or scaling ramifications have.

also, other consequences may have aren't related performance? example, exceptions wrapped in aggregateexception, represents additional complexity , work handling exceptions.

your memory usage increment application's parallelism. every concurrent phone call myactionmethod need separate thread own stack. cost 1 mb of ram each concurrent call. if myactionmethod runs long plenty 10000 instances run @ once, you're looking @ 10 gb of ram. there cpu overhead in setting each thread.

if concurrency low, dropping async back upwards won't problem. in case, don't bother task::run. alter myactionmethod homecoming somedto^ (no task wrapper).

another potential concern lose easy utilize of cancellation tokens. however, web api it's fine allow exception propagate web api, ends cancelling synchronous phone call anyway.

finally, if planning on performing operation within action method in parallel, you'll still need utilize continuewith accomplish that. going non-async default means you'll perform 1 operation @ time. fortunately, it's fine so.

asp.net .net asynchronous asp.net-web-api c++-cli

c# - How to save and read a text? -



c# - How to save and read a text? -

i using c# , know how save , read file, save more informations, awesome if saved file like:

player-level = 1;

player-money = 100;

etc.

use playerprefs.

example:

public class exampleclass : monobehaviour { void savescore(int score) { playerprefs.setint("player score", score); } void getscore() { print(playerprefs.getint("player score")); } }

c# unity3d

java - work fine in debug mode of the eclipse but fails when deploying as ear file deploying -



java - work fine in debug mode of the eclipse but fails when deploying as ear file deploying -

i facing aissue weblogic server, when trying deploy application through eclipse working fine , doing encrpytion (while encrpytion mean bouncy castle error encrypt string in java while deploying in weblogic server. issue got resolved changing poilcies in in lib of jre). when same application deployed ear file in same server failed rsa encryption.

if can help how reslove issue appreciated....

java eclipse deployment weblogic12c

java - One unit per case or one unit per assert(s) -



java - One unit per case or one unit per assert(s) -

in unit-tests should write 1 unit per case or 1 unit per assert back upwards cost point of view? have next code

void methodundertest(resource resource) { if(!resource.hasvalue()) { value value = valueservice.getvalue(resource); resource.setvalue(value); } // resource.setlastupdatetime(new date()); // added in future db.persist(resource); email.send(resource); }

the commented line added in near future , think cost update units.

as far see there 2 ways test code.

write 2 units passing resource value , without value. in both tests verify db.persist , email.send called. when lastupdatetime added i'll have update both tests verify property set.

write separate unit tests: 1 checks db.persist called, other checks email.send, 3rd , 4th resource , without value. when lastupdatetime added write new unit.

i sec way because thought won't have touch working units. lot of code duplication because 4 tests same , utilize different asserts.

the first approach looks more right 'just 1 concept per unit test' point of view. aren't such tests hard maintain? adding new have revise existing tests , doesn't sound good.

is there best practise here should follow?

i propose set mutual stuff of tests setup() tests, have 1 assert per unit test, in sec way of testing.

when add together new line of code, add together 1 more test case single assert.

not modification of existing tests, not code duplication.

java unit-testing

c# - Operator '==' cannot be applied to operands of type 'int' and 'string -



c# - Operator '==' cannot be applied to operands of type 'int' and 'string -

i'm in middle of writing programme think of number, , computer guesses it. i'm trying test go along, maintain getting error should'nt be. error topic title. used int.parse convert strings, don't know why i'm getting error. know says '==' can't used integers, i've seen online plus slides class utilize it, i'm stuck. code incomplete , i'm not trying run yet, want prepare problem. appreciate help lot, :d

class programme { static void main(string[] args) { console.write("enter number after 5 start: "); int reply = int.parse(console.readline()); { console.writeline("is 3?"); if (answer == "higher")

you inquire number, trying compare non-numeric data. forget language semantics, how expect compare number text? mean inquire if number 3 equal "higher"?

the reply is nonsensical; 1 reason why language not allow it.

int = 1; string b = "hello"; if (a == 1) { /* works; comparing int int */ } if (a == "hello") { /* comparing int string!? not work. */ } if (b == 1) { /* not work -- comparing string int. */ } if (b == "hello") { /* works -- comparing string string. */ }

you can forcefulness comparing compile converting number string:

if (answer.tostring() == "higher")

but status will never met because there no int value convert text "hello". code within of if block guaranteed never execute. might write if (false).

c# string int operator-keyword

Finding same values in a row of csv in python -



Finding same values in a row of csv in python -

i have code looks numbers within csv file within 1.0 decimal places of each other in same row. although, when run it, prints everything. not rows have status want i.e. values 2nd , 3rd column within 1.0 of each other. want run code , have display, first column (the time @ recorded or improve yet column number), 2nd , 3rd column because should within 1.0 of each other. info file looks like:

time chan1 chan2 04:07.0 52.31515503 16.49450684 04:07.1 23.55230713 62.48802185 04:08.0 46.06217957 24.94955444 04:08.0 41.72077942 31.32516479 04:08.0 19.80723572 25.73182678

here's code:

import numpy np matplotlib import * pylab import * filename = raw_input("enter file name: ") + '.csv' filepath = '/home/david/desktop/' + filename info = np.genfromtxt(filepath, delimiter=',', dtype=float) first=[row[0] row in data] rownum1=[row[1] row in data] rownum2=[row[2] row in data] row in data: if ((abs(row[1]-row[2]) <= 1.0)): print("the values in row 0 1 , 2, within 1.0 of each other.", first, rownum1, rownum2)

this output:

26.3460998535, 44.587371826199998, 42.610519409200002, 24.7272491455, 89.397918701199998, 25.479614257800002, 30.991180419900001, 25.676086425800001

but want output:

4:09.0, 23.456, 22.5

you can this:

data = np.genfromtxt(filepath, names=true, dtype=none) idx = np.abs(data['chan1'] - data['chan2'])<1 print data[idx]

python csv

google play - No compatible devices Android Market -



google play - No compatible devices Android Market -

hello i've been having problems when upload app play store says 0 compatible devices don't know what's wrong apk compiles , works on many devices i've tested there way prepare people can't download app.

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.qbotindustries.moremobs" > <supports-screens android:anydensity="true" android:largescreens="true" android:normalscreens="true" android:resizeable="true" android:smallscreens="true" android:xlargescreens="true" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@android:style/theme.notitlebar.fullscreen" android:hardwareaccelerated="true" > <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <activity android:name=".mainsplashscreen" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".firstscreen" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> </intent-filter> </activity> <activity android:name="com.google.android.gms.ads.adactivity" android:configchanges="keyboard|keyboardhidden|orientation|screenlayout|uimode|screensize|smallestscreensize" /> <activity android:name="com.jirbo.adcolony.adcolonyoverlay" android:configchanges="keyboardhidden|orientation|screensize" android:theme="@android:style/theme.translucent.notitlebar.fullscreen" /> <activity android:name="com.jirbo.adcolony.adcolonyfullscreen" android:configchanges="keyboardhidden|orientation|screensize" android:theme="@android:style/theme.black.notitlebar.fullscreen" /> <activity android:name="com.jirbo.adcolony.adcolonybrowser" android:configchanges="keyboardhidden|orientation|screensize" android:theme="@android:style/theme.black.notitlebar.fullscreen" /> </application> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state"/> <uses-permission android:name="android.permission.write_external_storage"/> <uses-permission android:name="android.permission.read_external_storage"/>

there's manifest :)

i suggest double check "uses-feature" , "supports-screens" elements in manifest file. used play store filter apps.

android google-play

android - connectedAndroidTest Null Pointer Exception -



android - connectedAndroidTest Null Pointer Exception -

i'm executing next test using android gradle plugin. next test fails npe @ getcontext(). appreciate if help me out problem

public class addtaskmanagertest extends androidtestcase { addtaskmanager manager = null; protected void setup() throws exception { super.setup(); manager = new addtaskmanager(getcontext()); } }

im running test using command ./gradlew connectedandroidtest

android android-gradle

c# - "System.Reflection.TargetInvocation Exception" in Windows Phone 8.1 -



c# - "System.Reflection.TargetInvocation Exception" in Windows Phone 8.1 -

i creating windows phone 8.1 app, have added wcf service in windows phone, when check wcf service, returns result, whenever trying phone call in windows phone project, giving me error.

system.reflection.targetinvocation exception

innerexception remains "null", can't getting main issue

how deal this, headache me. help appreciated.

here simple code:

servicereference1.service1client client = new servicereference1.service1client(); client.xxxxasync(id,name); client.xxxxcompleted += client_xxxxcompleted; void client_xxxxcompleted(object sender, servicereference1.xxxxcompletedeventargs e) { e.result = "giving error" - "targetinvocation exception" }

i getting error:

"error loading xaml, clr-microsoft.phone.controls.toolkit"

c# windows-phone-8.1

docker - Images are being cached even if there are changes -



docker - Images are being cached even if there are changes -

i have on docker automatic build image based on ubuntu custom configurations re-use base of operations image on other specific dockerfiles particular projects. works okay.

i made alter it, committed github started , did automatic build on docker.

from 1 of these other projects, i'm calling @ origin of dockerfile myuser/myimage not getting lastly image changes, rather keeps caching old one.

shouldn't automatically?

you need docker pull latest version. docker looks image from locally. doesn't notice if tag has been updated in registry came from. have script runs docker pull before building images.

docker

python - WSGI script displays as text, how can I make it execute? -



python - WSGI script displays as text, how can I make it execute? -

i have followed instructions on flask site deploying using wsgi.

i know apache2 server has wsgi enabled

$ sudo apache2 -m loaded modules: core_module (static) ... wsgi_module (shared) syntax ok

but when go site address, shows contents of wsgi script. expected execute script instead.

for example, modwsgi wiki has several test scripts can run check config, when modify wsgi script contain 1 of these test scripts , point browser script, see source code in browser.

i see no errors in apache2 log files. doing wrong?

my apache2 config looks this

1 <virtualhost *> 2 servername example.com 3 4 wsgidaemonprocess appname user=www-data group=www-data threads=5 5 wsgiscriptalias /appname /var/www/appname/appname.wsgi 6 7 <directory /var/www/appname> 8 wsgiscriptreloading on 9 wsgiprocessgroup appname 10 wsgiapplicationgroup %{global} 11 order deny,allow 12 allow 13 </directory> 14 </virtualhost>

/var/www/appname/appname.wsgi looks this

import sys def application(environ, start_response): status = '200 ok' output = '' output += 'sys.version = %s\n' % repr(sys.version) output += 'sys.prefix = %s\n' % repr(sys.prefix) response_headers = [('content-type', 'text/plain'), ('content-length', str(len(output)))] start_response(status, response_headers) homecoming [output]

python flask apache2 wsgi

javascript - effect on jquery created dynamically tag -



javascript - effect on jquery created dynamically tag -

i have problem jquery. have xml file utilize load list of video information. on each element in xml need see effect jquery (fadetoggle etc).

the problem not work, show code

<script type="text/javascript"> $(document).ready(function(){ $.ajax({ type:"get", url:"menu.xml", datatype:"xml", success: function(xml){ $(xml).find("food").each(function(){ var nome = $(this).find('nome').text(); var ingredienti = $(this).find('ingredienti').text(); $("#listapizza").append("<li class=\"list\"><a class=\"acla\" href=\"#\">"+nome+"</a> <div class=\"divhide\" style=\"display:none\">("+ingredienti+")</div></li>"); }); }, error: function(request, error, tipo_errore) { alert(error+': '+ tipo_errore); } }); $(".acla").click(function(){ $(this).next().fadetoggle(1500); }); }); </script>

this container of list

<ul id="listapizza"> </ul>

i can not understand why not work

tnx

use event-delegation since dynamically appended.

$("#listapizza").on("click", ".acla", function(){ $(this).next().fadetoggle(1500); });

javascript jquery xml html5

extjs - if condition not working in sencha touch -



extjs - if condition not working in sencha touch -

i using sencha touch developing mobile application. in list, using css alter color of values greater 0 (to green) , lesser 0(to red). values less 1000 color changes values greater 1000 color not changing.. please help

my code

<div class="amt_txt"> <tpl if="amount &gt;= 0"> <span class='drill'> <strong> <span class='dollartxt'> $ </span> {amount} </strong> </span> <tpl elseif="amount &lt;=0"> <span class="ylddatacolor3"> <span class='dollartxt'> $ </span> {amount} </span> </tpl> </div>

i utilize function this:

new ext.xtemplate( '<div class="amt_txt">' + '<span class="classforbold{[this.classchooser(values)]}">' + // <<--- here phone call '<span class='dollartxt'>' + '$' + '</span>' + '{amount}' + '</span>' + '</div>', classchooser: function(values) { // <<--- here function var amount = value.amount, returnvalue; switch (amount) { case < 1000: returnvalue = ' drill'; // of import leading blank break; case < 0: returnvalue = ' ylddatacolor3'; break; default: returnvalue = ''; } homecoming returnvalue; } )

extjs sencha-touch smarty

java - Send email and update database -



java - Send email and update database -

i read items database using repositoryitemreader convert them mimemessages using itemprocessor , send them using mimemessageitemwriter

all of works great.

but when project email has been sent, update database project , set sentmail date, next time job run, doesn't resend emails have gone out.

where should database change?

in reader? happens if smtp doesn't repond, whole chunk rolled back? in processor, or composite processor? in writer? that's no because it's mimemessage , don't have projectid more.

or should utilize listener?

you should have service level class wraps whole processing :

read database (and maintain id) create mimemessage send message update database

that way can update database if send message (ok smtp server, starting point story ...)

edit: in context of spring-batch, service level spring-batch itself

in context of spring-batch, reader part fine, , should utilize mimemessageitemwriter send message. must able follow steps described above. imho simple solution extend mimemessage in class :

class messageandid extends mimemessage { private int databaseid; // or whatever id private boolean senderror; public messageandid(mimemessage source, int databaseid) { super(source); this.databaseid = databaseid; senderror = false; } }

your itemprocessor should convert input messageandid, , author should composite writer, first calling mimemessageitemwriter custom error handler set senderrorto true in handle method, next calling itemwriter update database knowing database id , status of each message.

java spring spring-batch