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