Posts

Showing posts from February, 2015

Fatal error: #include <stdio.h> generated after "pip install mysql-python" command -

like many people, having issues getting mysql , python work together. specs are: osx10.9.2 anaconda 1.9.1 python 2.7.2, although 2.5 , 2.6 appear included mysql 5.6.16 i have written python script try import mysqldb, or pymysql mysqldb, neither works. i read many of threads on stack overflow, , result tried $ export cflags=-qunused-arguments $ export cppflags=-qunused-arguments $ pip install mysql-python the results below. fatal error issued, can seen @ bottom of output. downloading/unpacking mysql-python downloading mysql-python-1.2.5.zip (108kb): 108kb downloaded running setup.py (path:/private/var/folders/lx/h7jq_qx92_j0n7plsjmr6wl40000gp/t/pip_build_vincent/mysql-python/setup.py) egg_info package mysql-python installing collected packages: mysql-python running setup.py install mysql-python building '_mysql' extension /usr/bin/clang -dndebug -g -fwrapv -o3 -wall -wstrict-prototypes -qunused-arguments -qunused-arguments -dversion_info=(1,2,5,...

html - Unsafe JavaScript attempt and cordova web security -

in mobile application have page iframe. <iframe id="activityframe"></iframe> to show iframe content run next code. var frame = document.getelementbyid('activityframe'); var url = "ourdomen.com"; iframe.setattribute('src', url); all iframe content loaded correctly. user can navigate between pages. on last page inside iframe "ourdomen.example" load other iframe payment form domen "secyrityservice.example". when user click submit button "secyrityservice.example" rederct on "ourdomen.com" iframe by <script type="text/javascript"> <!-- $(function() { document.redirectform.submit(); }); //--> </script> </head> <body> <form name="redirectform" action="ourdomen.example" method="post" target="_parent...

c++ - Overloading operator trouble -

hello i'm trying create program reads in series of infix expressions file until reaches semi-colon or period (a+b.), , output postfix of expression file. i'm having trouble getting overloaded operators work correctly. can give me tips on what's wrong them? std::istream& operator>>(std::istream& in, expression& x) { char y; { in >> y; x.ifix += y; if (y == '.') { x.last = true; } } while (y!= ';' || y!= '.'); x.converttopostfix(); return in; } std::ostream& operator<<(std::ostream& out, const expression& x) { out << x.pfix; return out; } this expression true: while (y != ';' || y != '.'); if y ';' , y can not '.' , second half true. same other way around when y '.' . you want while (y != ';' && y != '.'); or, if want express more human: ...

javascript - how to select select2 using another select2 values -

i have 2 select2 input boxes, requirement if selected 1 select2 box value effect select2 box. my code below: <input class="select2-offscreen itemid_0" type="text" name="itemid" id="itemid[]" style="width:100px; left:297.5px !important; top:863px !important; float:left !important" tabindex="-1" onchange="display();"> <input class="select2-offscreen unitid_0" type="text" name="unitid" id="unitid[]" style="width:100px; left:297.5px !important; top:863px !important; float:left !important" tabindex="-1"> <script> function display(){ $(".unitid_0").select2("val","hr"); } </script> please tell me did mistake? thanks, madhuri you mean value in both boxes should same, right? $(function () { $(".itemid_0").keyup(function () { // on key in first box var value = $(this...

HTML text field input can only accept 1 or 0 as a value in Perl -

may ask, how can html accept text field input 1 or 0 value? can show me? implement html in perl. here example of code: #!/usr/bin/perl #index5.cgi require 'foobar-lib.pl'; ui_print_header(undef, $module_info{'desc'}, "", undef, 1, 1); ui_print_footer("/", $text{'index'}); #print "content-type:text/html\n\n"; print qq~<html> <link rel="stylesheet" type="text/css" href="style.css"> <body> <div id="content"> <div id="bar"> <span><p>data gateaway</p></span> </div> <div id="main-container"> <table border="0" width="100%" height="100%"> <tr> <td colspan="5"> <div id="button"> <form action="index.cgi"> <input type="submit" value="back"> </form> </div> </td> </tr> <t...

web services - Java Rest webservice with bad queryparam -

i have below web service method, @get @produces({ "application/xml", "application/json" }) @path("/service/salesorder/{identifier}/{ordertype}") public response readorder(@pathparam("identifier") string identifier, @pathparam("ordertype") string ordertype); if user calls below correct url, want service work fine, if 1 calls bad url (extra query param), not defined in method, want throw error, how can catch bad urls? correct url : http://myapp.com/service/salesorder/123/shoppingorder bad url : http://myapp.com/service/salesorder/123/shoppingorder&badparam addionial should inject @context method parameter: public response readorder(@pathparam("identifier") string identifier, @pathparam("ordertype") string ordertype, @context httpservletrequest req); and check servlet api httpservletrequest#getparameternames() if...

javascript - Titanium mobileweb font face not working -

we developing apps android, ios , mobile web using titanium. want change font of text , working fine on android, ios, mobile web on emulator. if open file on browser (ie firefox), font not working. there code changing font: "textfield": { height : 40, color : "#000000", returnkeytype : titanium.ui.returnkey_done, backgroundfocusedcolor : "transparent", font: { fontsize : 16, fontfamily : "opensans-regular" } } and when check firebug, shows this: @font-face { font-family: "mobileweb\f ontsopensans-regular"; src: url("mobileweb\f ontsopensans-regular.ttf,mobileweb\f ontsopensans-regular.woff"); } which not gonna work since font-family shows address , not font name. searched on web , see if have solution , cant find one. maybe bug know if guys have workarounds on this. ill appreciate help. thanks! you need set text value above or below "font: {}...

c++ - Why below exception safety code using auto_ptr is different? -

here's code not exception safe //header file declaration void f(auto_ptr<t1>, auto_ptr<t2>); //implementation file: f(auto_ptr<t1>(new t1), auto_ptr<t2>(new t2)); exception safe solution above suggested : //implementation file: { auto_ptr<t1> t1(new t1); auto_ptr<t2> t2(new t2); f(t1, t2); } my question why it's different when both uses auto_ptr handle resource allocation? this problem-solution part of "more exceptional c++" herb sutter. the problem first code snippet order 2 sub-expressions building f() parameters executed undefined c++ standard. is, if happens like: allocate & construct t1 auto_ptr takes ownership of t1 allocate & construct t2 auto_ptr takes ownership of t2 this work fine. quite possible order like: allocate & construct t1 allocate & construct t2 auto_ptr takes ownership of t1 auto_ptr takes ownership of t2 and in case if step 2 (alloc t2) throw...

get row by name not working in sqlite android -

i trying 1 row passing string, returning null . idea? main.java int close = 0; string companies=company.gettext().tostring(); cursor port=mydb.getrowlasttran(companies); close=port.getint(2); port.close(); dbadapter.java public cursor getrowlasttran(string company) { string = key_companies + "= '" + company+"'"; cursor c = db.query( database_table_lasttran, all_keys_lasttran, where, null, null, null, null, null); if (c != null) { c.movetofirst(); } return c; } here logcat 03-24 04:00:26.246: e/androidruntime(27711): fatal exception: main 03-24 04:00:26.246: e/androidruntime(27711): process: com.example.merostock, pid: 27711 03-24 04:00:26.246: e/androidruntime(27711): java.lang.illegalstateexception: not execute method of activity 03-24 04:00:26.246: e/androidruntime(27711): @ android.view.view$1.onclick(view.java:3823) 03-24 04:00:26.246: e/androidruntime(27711): @ android.view.view.performclick(view.java:44...

c# - EF 5 Code-First Seeding self referencing table -

here's code: base class: public class baseent { [key] public int id { get;set; } public datetime insertdate { get; set; } public int insertuserid { get; set; } public datetime updatedate { get; set; } public int updateuserid { get; set; } [timestamp] public byte[] timestamp { get; set; } public virtual user insertuser { get; set; } public virtual user updateuser { get; set; } } user entity: public class user:baseent { public string username { get; set; } public string fullname { get; set; } public virtual icollection<user> insertedusers { get; set; } public virtual icollection<user> updatedusers { get; set; } } model creating: protected override void onmodelcreating(dbmodelbuilder modelbuilder) { modelbuilder.entity<user>() .hasrequired(t => t.insertuser) .withmany(t=>t.insertedusers) .hasforeignkey(t =...

c# - row in index value in grid always taking from zero onwards..how to get row index value properly -

whenever executing grid value of row id taking 0 delete , edit operations not performing well. any 1 please me. in advance protected void grd_view_rowcommand(object sender, system.web.ui.webcontrols.gridviewcommandeventargs e) { if (e.commandname == "edit") { int rowid = 1; rowid = convert.toint32(e.commandargument); session["rowid"]= rowid; datatable dt = new datatable(); sqlconnection con = new sqlconnection(mystr); sqlcommand cmd = new sqlcommand("select * customerprofmain customercode='" +rowid+ "'", con); sqldataadapter sda = new sqldataadapter(cmd); con.open(); dataset ds = new dataset(); sda.fill(ds); dt=ds.tables[0]; textbox1.text = dt.rows[0]["customername"].tostring(); textbox2.text=dt.rows[0]["address"].tostring(); textbox3.text=dt.rows[0]["tellno"].tostring(); ...

linux - Input of dynamic size using fgets in C -

i want have string(can contain spaces) input. want dynamic allocation. structure of program this. #include<stdio.h> #include<string.h> #include<stdlib.h> typedef struct msgclient { int msglen; int msgtype; char *cp; }m1; int main() { m1 *m; m=malloc(sizeof(m1)); m->msglen=5; m->msgtype=6; printf("enter\t"); fgets(m->cp,50,stdin); //here // m->cp[strlen(m->cp)]='\0'; printf("\n%d\n%d\n",m->msglen,m->msgtype); fputs(m->cp,stdout); return 0; } i want know how input. there way second argument of fgets dynamic? use getline(3) -instead of fgets(3) - reads dynamically allocated line. typedef struct msgclient { ssize_t msglen; int msgtype; char *cp; }m1; then in main function m1 *m; m=malloc(sizeof(m1)); if (!m) { perror("malloc"); exit(exit_failure); }; m->msglen=0; m->msgtype=6; m->cp = null; printf("enter\t")...

Batch script to delete file older than 1 day using creation date -

batch script delete file older 1 day. d means: run date passing through command prompt. how subtract 1 day in d. i want delete 1 day old file,the file name starting olddayfile_20140323.txt in same code. am using below code deleting d (d:current day file) files. @echo on rem %1 %2 %3 - yyyy mm dd set folder1="c:\fx\in" set folder2="c:\fx\out" set d=%1%2%3% cd /d %folder2% del test1_%1%2%3* del test2_%1%2%3* del test3_%1%2%3* please note below script working,but it's working modified date files. forfiles.exe /p c:\fx\out /s /m olddayfile_* /d -1 /c "cmd /c del @file" please suggest me new batch script. try below code delete file name of 1 day less current date (format yyyymmdd) @echo off setlocal call :getdatetime year month day set a=%year%%month%%day% call :subtractdate %year% %month% %day% -1 ret set b=%ret% @echo ###start deleting :: variables set source=g:\ echo ### deleting old backup... del...

sql server - Linux + Django + SQLServer -

i writing django application needs intereact sqlserver database. use django mssql backend ado . i trying use in linux machine (centos 6.4), moment not able establish connection. anyone has suceeded on or knows if possible connect django-mssql linux environment? note: i've found this question quite old. looking up-to-date answer. edit: error receiving following. remark linux machine. django.core.exceptions.improperlyconfigured: 'sqlserver_ado' isn't available database backend. edit 2: pywin32 requirement django-mssql package. possible workaround linux? django-mssql works on windows, hence pywin32 dependency (actually, ado windows dependent since it's built on microsoft's activex). try django-sqlserver . it's based on django-mssql can pass info using python-tds not platform specific.

java - Need explaination on two different approach to find factorial -

i beginner.i learned c. java seeming difficult me. in c programming approach simple , when looked @ book's programs simple task such factorial, given complex programs below - class factorial { // recursive method int fact(int n) { int result; if(n==1) return 1; result = fact(n-1) * n; return result; } } class recursion { public static void main(string args[]) { factorial f = new factorial(); system.out.println("factorial of 3 " + f.fact(3)); system.out.println("factorial of 4 " + f.fact(4)); system.out.println("factorial of 5 " + f.fact(5)); } } instead, when made own program (given below) keeping simple , worked , easy. can tell me what's difference between 2 ? public class simplefacto { public static void main(string[] args) { int n = 7; int result = 1; (int = 1; <= n; i++) { result = result * i; } sys...

database - SyntaxError: Unknown Column -

public void updatetable(){ try{ string sql = "select user_lastname, user_firstname, user_mi, user_address, user_contact, user_email loginform"; ps = conn.preparestatement(sql); rs = ps.executequery(); table.setmodel(dbutils.resultsettotablemodel(rs)); } catch(exception e){ joptionpane.showmessagedialog(null, e); } } i have method when run program got syntaxerror .. please me solve this

Syntax Highlighting in Notepad++: how to highlight timestamps in log files -

i using notepad++ check logs. want define custom syntax highlighting timestamps , log levels. highlighting logs levels works fine (defined keywords). however, still struggling highlighting timestamps of form 06 mar 2014 08:40:30,193 any idea how that? if want simple highlighting, can use notepad++'s regex search mode. open find dialog, switch mark tab, , make sure regular expression set search mode. assuming timestamp @ start of line, regex should work you: ^\d{2}\s[a-za-z]+\s\d{4}\s\d{2}:\d{2}:\d{2},[\d]+ breaking down bit bit: ^ means following regex should anchored start of line. if timestamp appears anywhere start of line, delete this. \d means match digit (0-9). {n} qualifier means match preceding bit of regex n times, \d{2} means match 2 digits. \s means match whitespace character. [a-za-z] means match character in set a-z or set a-z, , + qualifier means match preceding bit of regex 1 or more times. we're looking alphabetic character seque...

sql - DB2 Trigger to avoid duplicates -

i new db2. had task like, have write trigger should avoid duplicates while inserting data. table : books columns : book_id, book_name, author, copies wrote trigger this: create or replace trigger tri_books_edit before insert on books referencing new n each row when ((select count(*) books book_name = n.book_name , author = n.author) > 0) signal sqlstate '75000' set message_text = 'duplicate row same name , author' but, sending error task insert data if bookname , author not present in db else should not insert

titanium - how to create JSON service URL Request/response for Ipad app -

i want develop ipad app titanium.my app needs data web/my sql db.i want use json.how create json url request , response , how use app? simple example great. wcf json check http://dotnetmentors.com/wcf/wcf-rest-service-to-get-or-post-json-data-and-retrieve-json-data-with-datacontract.aspx webapi json check http://www.hanselman.com/blog/oneaspnetmakingjsonwebapiswithaspnetmvc4betaandaspnetwebapi.aspx

c++ - Extraction operator causing my program to exit? -

i'm usual lurker first post! understand guys detail best. appreciate whatever input has. i working on overloading extraction operator object dynamic array of digits. console input have leading white space, int, after. need ignore white space, extract int, , leave rest alone. easy right? here example of code found online: istream & operator >> (istream &m, myint & p) { int x = 0; p.currentlength = 0; while ((m.peek() == '\n') || (m.peek() == '\0') || (m.peek() == '\t') || (m.peek() == ' ')) { m.get(); } while ((m.peek() >= '0') && (m.peek() <= '9')) { if (p.currentlength >= p.maxsize) { p.grow(); } m >> p.thenumber[x]; x++; p.currentlength++; } m.get(); // reverse order (i.e. - 123 321) char * temp = new char[p.maxsize]; (int y = 0; y < p.current...

google adwords python api - how to get ad group bid -

i using adwords python api. need bid amount , type. e.g. bid=4 ad type = cpc. i given adgroup id. below example on create , ad group. once created...how retrieve settings? how e.g. bid set? ad_group_service = client.getservice('adgroupservice', version='v201402') operations = [{ 'operator': 'add', 'operand': { 'campaignid': campaign_id, 'name': 'earth mars cruises #%s' % uuid.uuid4(), 'status': 'enabled', 'biddingstrategyconfiguration': { 'bids': [ { 'xsi_type': 'cpcbid', 'bid': { 'microamount': '1000000' }, } ] } } }] ad_groups = ad_group_service.mutate(operations) have @ corresponding example on googla...

javascript - Youtube API V3 - Missing items in playlist when requesting them with playlistItems.list -

i have been trying items in this playlist , has 64 items in it, javascript. this function have been using response , display items in response: function getplaylistitems( playlistid, maxresults, pagetoken ) { var requestoptions = { playlistid: playlistid, part: 'snippet', maxresults: maxresults, fields: "items,nextpagetoken" }; if ( pagetoken ) { requestoptions.pagetoken = pagetoken; } var request = gapi.client.youtube.playlistitems.list( requestoptions ); request.execute( function( response ) { var playlistitems = response.items; console.log( playlistitems.length, playlistitems ); $.each( playlistitems, function( index, item ) { displayresult( item.snippet.title ); } ); if ( response.nextpagetoken ) { console.log( response.nextpagetoken ); getplaylistitems( playlistid, maxresults, response.nextpagetoken ); }...

iOS: UIScrollView zooming programmatically not working -

i have pageable uiscrollview contains different kind of informations uitables zoomable images. therefore set pageable main-scrollview , subviews added zoomable image-scrollviews images content. works fine, fail set smaller current zoom scale of imagescrollviews. uiimageview *imageview = [[uiimageview alloc] initwithimage:image]; //storing link imageview [imagelinkarray addobject:imageview]; cgrect scrollviewimagerect; scrollviewimagerect = cgrectmake((self.scrollview.frame.size.width) * i, 0, 320, self.scrollview.frame.size.height); float widthfactor = scrollviewimagerect.size.width / imageview.frame.size.width; float heightfactor = scrollviewimagerect.size.height / imageview.frame.size.height; float zoomscale = min(widthfactor, heightfactor); uiscrollview *imagescrollview = [[uiscrollview alloc] initwithframe:scrollviewimagerect]; imagescrollview.contentsize = cgsizemake(imageview.frame.size.width, imageview.frame.size.height); imagescrollview.delegate = self; [imagescroll...

OrientDB - Problems with Clusters Concept -

i have got problem clusters in orient db. sure understanding of clusters correct , great if me problem. my understanding of clusters first ensure understand concept of clusters correctly: me cluster subset of data, 1 cluster can contain different classes , single class can contained in different clusters, correct ? so example have data: {"name": "john", "sports": "tennis", "gender": "male", "@class": "assistant"} {"name": "susan", "sports": "hockey", "gender": "female", "@class": "assistant"} {"name": "peter", "sports": "hockey", "gender": "male", "@class": "trainee"} {"name": "mary", "sports": "tennis", "gender": "female", "@class": "trainee"} and can have ...

Trying to read pdf file stored in res folder android -

here code given below..wenever try open dat activity shows target file doesnt exist..please me.....thanks in advance public class mainactivityalgb extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main_activity_algb); copyreadassets(); } private void copyreadassets() { assetmanager assetmanager = getassets(); inputstream in = null; outputstream out = null; file file = new file(getfilesdir(), "cure.pdf"); try { in = assetmanager.open("cure.pdf"); out = openfileoutput(file.getname(), context.mode_world_readable); copyfile(in, out); in.close(); in = null; out.flush(); out.close(); ...

html - How to copy a clip image on the canvas -

the code below works fine how can make copy of "stoplicht" , place copy elsewhere on canvas? <!doctype html> <html> <body> <p>image use:</p> <img id="sprite-sheet" src="logi.bmp" alt="logi" width="220" height="277"> <p>canvas:</p> <canvas id="mycanvas" width="512" height="380" style="border:1px solid #d3d3d3;"> browser not support html5 canvas tag.</canvas> <script> var canvas = document.getelementbyid('mycanvas'); var ctx = canvas.getcontext('2d'); var img = document.getelementbyid("sprite-sheet"); function stoplicht() { //rij x groen stoplicht ctx.drawimage(img, 64, 8,8,8,80, 0,8,8); ctx.drawimage(img, 72, 8,8,8,88, 0,8,8); ctx.drawimage(img, 80, 8,8,8,80, 8,8,8); ctx.drawimage(img, 88, 8,8,8,88, 8,8,8); ctx.drawimage(img,112,24,8,8,80,16,8,8); ctx.drawimage(img,120,24,8,8,88,16,8,8);...

java - BDB LongBinding vs ByteArrayBinding static methods -

in longbinding class, methods entrytolong(databaseentry entry) , longtoentry(long val, databaseentry entry) both static. but in bytearraybinding class, entrytoobject(databaseentry entry) , objecttoentry(byte[] object, databaseentry entry) both not static. the implementations of these methods seem similar. example, upon examining source code, 1 can see both longtoentry , objecttoentry methods delegating entry.setdata , entry method parameter type databaseentry . why these 2 longbinding methods static, while analogous bytearraybinding methods not? in pom.xml, have following dependency: <dependency> <groupid>com.sleepycat</groupid> <artifactid>je</artifactid> <version>4.1.21</version> </dependency> there not explanation. the methods in bytearraybinding (and should?) have been static have no reference instance of class. those 2 classes have been written different developpers , implemented function...

c - how to use scanf to get input to include space -

i new c have been confused let's have code want use char char a, b, c; printf("input first character: "); scanf(" %c", &a); printf("input second character: "); scanf(" %c", &b); printf("input thrid character: "); scanf(" %c", &c); how ever want able read in space well; noticed how read in non-space characters, if want read space c=' '; how scan space in; now listening suggestion of using getchar() wrote : #include<stdio.h> int main(void) { char a,b,c; printf("input first char:"); a=getchar(); printf("input second char:"); b=getchar(); printf("input third char:"); c=getchar(); return 0; } how ever strange happens when compile , run program the program output input first char: input second char:input third char: now never let me input second char jumped straight third request @ end asked enter 2 inputs strange becau...

c# - Enable and disable Control on database value change -

i have situation have disable controls on database value change. for have used following code. here disabling controls in panel on 0 value , on other values enabling it. using system; using system.collections.generic; using system.data; using system.data.sqlclient; using system.linq; using system.text; using system.web; using system.web.script.serialization; using system.web.ui; using system.web.ui.webcontrols; public partial class test_control : system.web.ui.page { string test1; list<double> _data = new list<double>(); public datatable dt = new datatable(); protected void page_load(object sender, eventargs e) { getdata(); } private void getdata() { int maxid; using (sqlconnection dataconnection = new sqlconnection("data source=localhost\\sqlexpress;initial catalog=mcas;integrated security=sspi")) using (sqlcommand datacommand = new sqlcommand("select top 1 run...

c++ - serializing classes using boost serialization without changing the class -

this piece of code has written every time make class i.e.from template<class archive> ar & boost_serialization_nvp(b) . how can make short? , how can serialize stl containers ? class employee { private: friend class boost::serialization::access; template<class archive> void serialize(archive & ar, const unsigned int version) { ar & boost_serialization_nvp(a); ar & boost_serialization_nvp(b); } int a; int b; public: employee(int a, int b) { this->a = a; this->b = b; } }; i suggest start documentation :) http://www.boost.org/doc/libs/1_55_0/libs/serialization/doc/index.html (start under serializable concept ) stl containers serializable when include relevant header: #include <boost/serialization/map.hpp> #include <boost/serialization/string.hpp> a host of other stuff supported out of box. you...

excel vba - How to refer correctly to a workbook from a cell that contains a volatile function? -

i have pretty stupid problem excel vba. i'm trying achieve function returns workbook property of workbook contains cell function inserted. ran problem whilst making function volatile , placing in personal workbook used of workbooks open (also addin). function - function zsetservermetadata(byval metatypename string, optional byval newvalue string = "") string 'recalculate upon every time cell changes application.volatile dim wb workbook set wb = application.activeworkbook on error goto nosuchproperty 'if value defined on newvalue, set value , showoutput if newvalue <> "" wb.contenttypeproperties(metatypename).value = newvalue zsetservermetadata = wb.contenttypeproperties(metatypename).value set wb = nothing exit function 'if no value defined on newvalue show output leave content type unchanged else zsetservermetadata = wb.contenttypeproperties(metatypename).value set wb = nothing exit function end if nosuchp...

android - How to know if their is change in call log using contentOberser. -

i new android development. want monitor changes occurred in call log.my code fetching call history until last recent call log.when run app again fetches logs including newest 1 want latest changes. please guide me how can achieve contentoberser ? please help. code private void conatctdetails() { stringbuffer sb = new stringbuffer(); cursor c1 = getcontentresolver().query(contactscontract.contacts.content_uri, null, null, null, contactscontract.contacts.display_name); sb.append("contact details:"); try { while(c1.movetonext()) { string id = c1.getstring(c1.getcolumnindex(contactscontract.contacts._id)); string name =c1.getstring(c1.getcolumnindex(contactscontract.contacts.display_name)); string timescontacted =c1.getstring(c1.getcolumnindex(contactscontract.contacts.times_contacted)); string lasttimecontacted =c1.getstring(c1.getcolumnindex(contactscontr...

c# - WPF Event to Command add to control from Codebehind -

i'm using event command explaind here: http://nerobrain.blogspot.nl/2012/01/wpf-events-to-command.html i try add controls codebehind, since dynamically have add them depending on data db. how perform same thing below codebehind how add "local" part in codebehind? update: this problem i'm trying solve, i'll try summerizes shortly :) the user supposed leave feedback after usage of application. feedback information can consist of multiple questions can either single choice multiple choice. so 1 feedbackset can have several feedbackgroups can either have single choice feedbackcodes or multiple choice feedbackcodes or have subgroups of feedbackgroups/feedbackcodes a single choice result in combobox a multiple choice result in listbox a subgroup generate treeview the model(shortend code): public class feedbackset { public int id{get;set;} public string name{get;set} public list<feedbackgroup> groups{get;set;} } ...

vb.net - How to use LinqToSql to select columns AS -

hi have user control has repeater bound 1 of 2 tables dependant on parameter set in user control. 2 tables have similar data in past have used sql connection , got data such.. if m_type = "std" 'type standard data s_updates sql="select s_user user, s_date udate, s_update update s_updates s_ref = " & m_caseref & " order s_date" else 'type bsm data b_updates sql="select b_device user, b_date udate, b_update update b_updates b_ref = " & m_caseref & " order b_date" end if i bind result repeater has layout 3 databound containers following syntax <%= databinder.eval(container.dataitem, "udate" %> <%= databinder.eval(container.dataitem, "user" %> <%= databinder.eval(container.dataitem, "update" %> i have been asked change code uses linqtosql i have following select s_updates dim caseupdate = u in dc.s_updates u.s_ref = m_caseref...

javascript - Cordova 3.x forcing screen orientation at run-time IOS -

this question has answer here: phonegap - forcing landscape orientation 5 answers i'm building app cordova forcing screen orientation @ runtime on pages crucial. found plugin com.phonegap.plugins.orientationlock works on android devices can't find solution ios... have solved issue? thank you updated response : i found plugin enables this: https://github.com/adlotto/cordova-plugin-recheck-screen-orientation . tested , verified on iphone 5 ios 7.1 - hooray! original response : i haven't yet found way force on ios, it's possible @ least choose orientations allowed dynamically @ run-time. that requires global shouldrotatetoorientation(degree) function returns true or false based on device's new orientation. more details here: https://groups.google.com/forum/#!topic/phonegap/xw7qsjvcf5i you could, theoretically, ask user rotate d...

ios - Get the http response code from every UIWebView request -

i need check response status code while loading of url in webview fo. can consider of web application loading inside web view.so need track down every request withing webview , check out response code accordingly. finding response code, need use nsurlconnection inside uiwebview's delegate method "shouldstartloadwithrequest". thing - - (bool) webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype{ nsurlconnection *conn = [nsurlconnection connectionwithrequest:request delegate:self]; if (conn == nil) { nslog(@"cannot create connection"); } return yes; } and nsurlconnectiondelegate -- - (void) connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response{ nslog(@"connection:didreceiveresponse"); [self log:@"received response."]; nshttpurlresponse *httpresponse = (nshttpurlresponse ...

vba - Hide images with excel filter -

Image
i have table range lists products , picture of product shown in 1 of cells. when filter products, images of products removed filter end behind other images rather hiding them, or images end being shuffled bottom of list, bit "ghost" product, picture , no info. is there easy way have these images disappear on filter? assume there way of doing vba, check intersect ranges , see if hidden, or renaming images correspond product code , see if still visible, there simpler way (as both methods may end me having rewrite fair chunk of code) example screnshots without filters: with filters (top row) with filters (last row , "ghost") figured out. setting images move , size cells ensure hidden (i have done through code when adding picture adding line .placement = xlmoveandsize , can done manually in menus too.

navigationbar - ios navigation bar item image size -

Image
i want customize navigation bar button , using own images. question size should be? found button size should 40*40, image should 80*80 retina? these sizes documentation recommends custom icons now. @1: 25 x 25 @2: 50 x 50 @3: 75 x 75 create 3 images of above pixel sizes , add them new image set in assets.xcassets file. (apparently @1 size no longer needed, though.) alternatively, use universal vector image (pdf) (see here , here ). has been preference recently. related answer ios how set app icon , launch images

wix - Wix3.8 WixUI_Advanced dialog how to skip license agreement -

i using wix3.8 , in install msi, need installscopedlg available using wixui_advanced, not first dialog license agreement. i have seen lot of posts on how skip (or not display) dialog using wixui_installdir not support installscopedlg. this have: <property id="applicationfoldername" value="outlook add in" /> <property id="wixappfolder" value="wixpermachinefolder" /> <ui id="uisequence"> <uiref id="wixui_advanced" /> </ui> can please show me how hide or skip license agreement while still using wixui_advanced. you need understand way windows installer flows dialog dialog through use of newdialog controlevents . dialog 1 have next pushbutton control newdialog control event says goto dialog 2. dialog 2 have button says go dialog 1. wix ui extension hides in attempt make easy create basic ui. however, can see if edit built msi using orca , @ controlevent table . the contr...

apc - Nginx PHP5-FPM Bad Gateway 502 -

i implemented new php class concats pdf documents 1 file. @ dev local server, works fine. after pushing production server, i'm running "bad gateway" error. /var/log/php5-fpm.log: 4-mär-2014 11:20:54] warning: [pool www] child 17386 exited on signal 11 (sigsegv - core dumped) after 10.380074 seconds start /var/log/nginx/example.com.error.log: 2014/03/24 11:58:25 [debug] 18761#0: *613 recv: fd:7 -1 of 4096 2014/03/24 11:58:25 [error] 18761#0: *613 recv() failed (104: connection reset peer) while reading response header upstream, client: 79.200.179.25, server: example.com, request: "get /documents/pdf_generator/140183/en http/1.1", upstream: "fastcgi://unix:/tmp/php5-fpm.sock:", host: "example.com", referrer: "http://booker.visioncode.de/documents/overview" 2014/03/24 11:58:25 [debug] 18761#0: *613 http next upstream, 2 2014/03/24 11:58:25 [debug] 18761#0: *613 free rr peer 1 4 2014/03/24 11:58:25 [debug] 18761#0: *613 finali...

python - Reading a text file, one chunk of n lines at a time -

i new python , have made questionnaire program. there way have program display each question , choices 1 @ time (the next multiple choice question doesn't show unless previous 1 answered)? i used slicing accomplish this, wondering doing not in practice or has better alternate way? #opens file questions, , told read via 'r' open("pythonq.txt", "r") f: #reads file line line 'readlines' variable = f.readlines() #issue no slicing, reading letter letter. #without slicing , split, questions not print per question #the goal slicing readlines read per question, not entire file or first 5 words line in variable[0:6]: #this strips brackets , splits commas only, otherwise print both question = line.split(',') #joins elements of list separated comma print(", ".join(question)) choice1 = eval(input("\nyour choice?: ")) #sliced second question. begins @ 5 provide room in program between ...

java - Struggling to understand how to use fields in a method -

i new java , struggling understanding basic concepts. example, here, trying write program generate random strings using "random" class in java: http://docs.oracle.com/javase/6/docs/api/java/util/random.html i noticed class can generate random integers, basically, idea generate random integers , convert them string, if possible. here code far: package øv2; import java.util.random; public class randomstringgenerator { private int randomnumber; private void setrandomnumber(int randomnumber){ randomnumber = this.randomnumber; } private int getrandomnumber(){ return randomnumber; } private string generaterandomstring(int randomnumber){ int randomstring = randomnumber.nextint(); } } what want take field "randomnumber" , turn random number using java class "random", more method "nextint()", , turn string. not understanding how use field "randomnumber" anywhere, need gette...

Serialize python parent class from inherited class to JSON - possible or stupid? -

i know there lot of question on json serialization, i'm still not grasping seems. given following class: import json class basemongoobject(object): def __init__(self): pass def jsonify(self): return json.dumps(self, default=lambda o: o.__dict) and following derived class: from assetfacts import assetfacts bmo import basemongoobject class asset(basemongoobject): def __init__(self): basemongoobject.__init__(self) self.facts = assetfacts() self.serial = none trying call asset.jsonify() using following piece of test code: from asset import asset def test_me(): = asset() a.serial = '123asdf' print a.jsonify() if __name__ == '__main__': test_me() produces following: traceback (most recent call last): file "../bin/test.py", line 17, in <module> test_me() file "../bin/test.py", line 13, in test_me print a.jsonify() file "/users/vla...

How to implement back button functionality of android in Sencha Touch using cordova? -

i have searched lot on topic. till not find proper solution. want implement button functionality of android in sencha touch using cordova. i have 2 views one.js two.js inside one.js have button. on clicking button go two.js using following code. ext.viewport.setactiveitem(ext.create('appname.view.two')); now of cordova able detect button press writing following code in index.html <script type="text/javascript" charset="utf-8"> document.addeventlistener("deviceready", ondeviceready, false); function ondeviceready() { alert("in device"); document.addeventlistener("backbutton", onbackkeydown, false); } function onbackkeydown() { alert("hello"); } </script> so piece of code should write inside onbackkeydown, when user presses buton when in two.js, should return one.js any appreciated. why don't use same function bring second...

Difference between `do.call()` a function and directly call a function in R? -

here code: >ipo_num_year<- do.call(length,list(as.name(paste0("all_data_align_",year)))) >ipo_num_year >90 >ipo_num_year<- length(as.name(paste0("all_data_align_",year))) >ipo_num_year >1 year string object "1999"; in previous code, all_data_align_1999 has been assigned list 90 elements,so right result ipo_num_year equals 90 .but second line makes ipo_num_year equals 1 ,it means length() function return value of as.name() symbol object,so length 1 . why return value of as.name() can not directly used argument of function length() ? , why first solution works fine? some 1 may ask why don't use length(all_data_align_1999) .that because year loop variable in code. really appreciate kindly reply! instead of as.name should use get : length(get(paste0("all_data_align_",year))) you need retrieve object not name.

jquery - Boostrap 3.0 Carousel - different width images -

i use bootstrap 3.0 carousel display image slider on webpage. page here: http://wasup.si/test-bid1 the problem have images of different width, of same height. images stick together. basically, width of item class should same of image. knows how can this? the full carousel width should still 100% of page, showing more items one. best way use other carousel http://owlgraphic.com/owlcarousel/demos/images.html <div id="owl-demo"> <div class="item"><img src="assets/owl1.jpg" alt="owl image"></div> <div class="item"><img src="assets/owl2.jpg" alt="owl image"></div> <div class="item"><img src="assets/owl3.jpg" alt="owl image"></div> <div class="item"><img src="assets/owl4.jpg" alt="owl image"></div> <div class="item"><img src="assets...

c# - Set a default value to the model being passed to Partial View -

i have partial view called partial view (kind of nested partial views). the outer partial view called company , inner partial view custom control called searchhelp. both accept parameter. now company view gets parameter of type company , searchhelper accepts optional string. part works fine testing model value null , assigning default text @((model==null)?"enter text":model) when used in other views without passing parameter. in case of nested views, if dont provide string model searchhelper takes company model outer view i.e company , gives error. you can assign default value string-as-model it's called in view: //null coalesce default string value: @html.partial("searchhelp", model.searchhelp ?? "default value") ...though might better using htmlhelper, can define default value 1 time: public ihtmlstring searchhelp(this htmlhelper html, string searchhelp = "default value") { // make html here } then @htm...

c++ - error LNK2019: unresolved external symbol __imp__pthread_self referenced in function -

i'm trying generate pthread lib wp8, lib file seems not work. take function thread_self() example explain it. first, use command check .lib: dumpbin /symbols pthread_lib.lib when grep output 'pthread_self', output contains information this: 01d 00000000 undef notype external | __imp__pthread_self 023 00000000 undef notype external | __imp__pthread_self 01a 00000000 undef notype external | __imp__pthread_self 011 00000000 undef notype external | __imp__pthread_self 011 00000000 undef notype external | __imp__pthread_self 011 00000000 undef notype external | __imp__pthread_self 011 00000000 undef notype external | __imp__pthread_self 011 00000000 sect4 notype () external | _pthread_self 012 00000000 undef notype external | __imp__pthread_self 012 00000000 undef notype external | __imp__pthread_self 018 00000000 undef notype external | __imp__pthread...