Posts

Showing posts from March, 2013

php - Solr DataimportHandler with MySQL and URLDataSource as JSON -

i have data-config.xml <dataconfig> <datasource name="sql" type="jdbcdatasource" driver="com.mysql.jdbc.driver" url="jdbc:mysql://server/db" user="user" password="pwd"/> <datasource name="web" type="urldatasource" connectiontimeout="5000" readtimeout="10000" /> <document name="doc"> <entity name="artikel" datasource="sql" query="select a.x1,a.x2,b.y1,b.y2 tab1 a, tab2 b a.id>0 , a.x1=b.y1" deltaimportquery="select a.x1,a.x2,b.y1,b.y2 tab1 a, tab2 b a.id>0 , a.x1=b.y1 id='${dataimporter.delta.job_jobs_id}' " deltaquery="select select a.x1,a.x2,b.y1,b.y2 tab1 a, tab2 b a.id>0 , a.x1=b.y1 tab1 a, tab2 b b timestamp > '${dataimporter.last_index_time}' , a.shopwgr=b.shopwgr"> ...

parsing - Postfix expression parser in Python -

i trying complete program running few things need with. need trying to: make sure user input correct , error test. like..... if token == "" or token == " " i not sure how make sure user input correct. assignment: write program (postfix.py) extracts postfix expression user , evaluates described in class. program should extract expression user via standard input. expression should formatted such there @ least 1 blank space between each operator , operand. example, enter postfix expression: 5 6 * 13 2 * + assume operators , operands valid. operands should integer values while valid operators include + - / * % after extracting expression, use split() method on string split individual tokens stored in python list. note multi-digit operand (i.e. 13 ) considered single token. the postfix expression should printed standard output, 1 token @ time, being evaluated. in addition, if expression valid, result should printed o...

mod rewrite - Deploy Django REST API to api.example.com: Apache 2.2, mod_wsgi and mod_rewrite -

i have been searching information on topic couple days , keep running road blocks. i have django web site , application running @ www.example.com , i'm forcing https. it's deployed on apache 2.2 wsgi. works fine , works both example.com , www.example.com . i have rest api ( pip install djangorestframework ) running @ https://www.example.com/api/v1/ . works fine. i want run api subdomain https://api.example.com , keep url in address bar. example, fetch json objects might use this: curl -x https://api.example.com/objects/ -h 'authorization: token xxx' i can using this: curl -x https://www.example.com/api/v1/objects/ -h 'authorization: token xxx' i have separate ssl certificate subdmain , has been correctly configured. i have tried many things in apache configuration accomplish failed @ every turn. thought use mod_rewrite silently fetch content https://www.example.com/api/v1/ while leaving https://api.example.com in address bar. possible? ...

db2 script: how to comment if I want to run the whole script at once with multiple statements? -

i have lots of sql statements in db2 , i'm putting in script , using query tool run commands after highlighting sql statements. my comments so: /* comments */ however, query tool complains of following: sql0198n statement string of prepare or execute immediate statement blank or empty. sqlstate=42617 i've tried using dash dash. same issue. remember taking mysql class before , able submit full scripts instructor grade. someone else having same issue: http://www.dbforums.com/showthread.php?1118891-how-do-i-put-comment-in-db2-udb-7-2 put sql statements inside file called script.sql -- sample comment -- create nation table create table "tpcd "."nation" ( "n_nationkey" integer not null , "n_name" char(25) not null , "n_regionkey" integer not null , "n_comment" varchar(152) not null ); then log instance user command line: su - db2inst1 and run script...

c# - Why are my bundles not loaded even when they have been included in the BundlesConfig? -

i have jquery, bootstrap bundles wish load in view, have added them bundlesconfig , added view in @script.render , scripts files not rendering cannot make use of bootstrap tags. bundles using system.web; using system.web.optimization; namespace xxxx { public class bundleconfig { // more information on bundling, visit http://go.microsoft.com/fwlink/?linkid=254725 public static void registerbundles(bundlecollection bundles) { bundles.add(new scriptbundle("~/bundles/jquery").include( "~/scripts/jquery-{version}.js", "~/scripts/bootstrap.js")); bundles.add(new scriptbundle("~/bundles/jqueryui").include( "~/scripts/jquery-ui-{version}.js")); bundles.add(new scriptbundle("~/bundles/jqueryval").include( "~/scripts/jquery.unobtrusive*", ...

html - Removing blue border in <form> submit button -

i trying remove small blue border around submit button appears when it's pressed. tried fix border: none; didnt fix it. code looks this: <html> <head> <link rel="stylesheet" type="text/css" href="theme.css" /> <link rel="stylesheet" type="text/css" href="hover.css" /> </head> <body> <form id="button1" action="#" method="post"> <input type="submit" value="orange" class="btn btn-warning"/> </form> </body> </html> jsfiddle i'm using xampp run on localhost , google chrome 42.0.2311.90 update .btn:focus { outline: none; } this fixed me! not not plan on making site accessible via keyboard not need blue outline. it's looks. i think looking this: <style> .btn:focus { outli...

Title going out of frame in plot canvas in R -

Image
hi have 3 plots density bars on either axis have done way (here simpler form presented 3 ordinary plots other parts necessary required more complicated function have left off here ease of viewing) scatterbar.norm <- function(x,y) { zones <- matrix(c(2,0,1,3), ncol=2, byrow=true) layout(zones, widths=c(5/7,2/7), heights=c(2/7,5/7)) title("my title", outer=true); par(mar=c(3,3,1,1),mgp=c(2,1,0)) plot(1:10, xlab="magnification", ylab="residue", col=2) par(mar=c(0,3,1,1)) plot(1:10, xlab="magnification", ylab="residue",col=3) par(mar=c(3,0,1,1)) plot(1:10, xlab="magnification", ylab="residue", col=4)} scatterbar.norm(2,3) the problem : firstly the plot title "my title" part going out of canvas , how fix ? thanks needed in advance. you've instructed r plot title in outer margin, (at least in example) haven't set margin...

oauth 2.0 - How to migrate from REST to GDAA Api without losing files? -

update: question below resulted bug in code (scanning wrong directory tree), rendering question irrelevant (and exposing stupidity in process). if deserves deletion, decided keep it, since answer (cheryl simon's) correct, valuable , substitutes gdaa's documentation. the original question starts here: app, i've been running awhile under drive scope of rest api created numerous folders / files in google drive. now, when building new version, switched gdaa api , none of files/folders can found under file scope of gdaa. has been understanding, file scope has access drive objects created app. needles did not modify sha1 / packagename combination in developer console. file scope access based on developer console project. if same developer console project used app using rest api , gdaa app, should able access files either.

Sikuli with selenium Grid & Maven -

can use sikuli selenium grid ? if remote machine have sikuli libraries ? other thing: cant find maven dependecies org.sikuli.script on http://mvnrepository.com/ there other way include jar maven ? the problem sikuli it's not going work on headless machines. can read more here . there have been attempts solve problem, can read here .

Why doesn't AngularJS detect checkboxes when using Bootstrap plugin? -

i'm using jquery plugin "bootstrap checkboxes", , angularjs framework. @ first plugin loaded page checkboxes inside angular controller: <input type="checkbox" required="" value="19" ng-model="formdata.type[19]" ng-click="setcheckbox(19)" name="type[]"> when click checkbox nothing happens, function setcheckbox(19) not called. why angular not see ng-model jquery plugin?

javascript - Why does a script work in Firebug's command line on one site but not on another? -

i using firefox , firebug's command line execute javascript on 2 different sites: https://graph.facebook.com/v2.3/172727819415642/albums?fields=id,name,cover_photo,photos%7bname,source%7d&limit=1&access_token=xxxxx http://www.iskcondesiretree.com/photo/album/list here's code: (function() { function r() { = $("body").text() console.log(a); }; var e = "1.6.4"; var t = false; if (!t) { t = true; var n = document.createelement("script"); n.src = "https://ajax.googleapis.com/ajax/libs/jquery/" + e + "/jquery.min.js"; n.onload = function() { r(); }; document.getelementsbytagname("head")[0].appendchild(n); }; })(); when run code in firebug's command line on site 1, returns following error: typeerror: $(...).text() not function when run code site 2 works fine. shows lot of text site. interesting thing is...

html - Exported SVG has no fill or stroke in the code -

Image
i'm trying manipulate/animate stroked svg icon i've made; however, when export svg illustrator, see this: <path d="m8,37.3c1-1.5 ...> when expect like: <path fill="none" stroke="#000000" d="m8,37.3c1-1.5 ...> so when try animate stroke using dasharray method, doesn't work. when try add stroke code 1 above, creates ugly outline on shape. the options this: i'm wondering how either export svg better, or edit code create stroke (not fill). if more information needed me, let me know.

hyperlink - How to link to the current PHP file -

i writing php file don't know best way create link while link in same file different id. mean have file named test.php , contains like: if ($id == "") { echo "<a href='".$_server['php_self']."?id=test'>try test page</a>"; } else if ($id == "test") { echo "here testing content various information!"; } i want know better more secure code: $_server['php_self']?id=test or test.php?id=test . i know serves same purpose now, if change file name $_server['php_self']?id=test seems better because still point same file. but know sure safer. you should not printing $_server['php_self'] ; it's security vulnerability (there's example here: how identify requested page in php ). if you're trying link same page, query parameters ( ? ) or anchors ( # ) can link directly them, @kingkero suggests. <!-- code snippet runs iframe http://stacksnip...

Mailchimp API 2.0 lists/subscribe responding with error 250 List_MergeFieldRequired MMERGE4 is required -

i'm attempting use lists/subscribe mailchimp api 2.0 endpoint subscribe email list, keep getting puzzling error. request looks like: { "apikey":"myapikey-us5", "id":"listid", "email":{"email":"my@email.com"}, "double_optin":false, "send_welcome":true } i'm sending https://us5.api.mailchimp.com/2.0/lists/subscribe.json , getting response: { "status": "error", "code": 250, "name": "list_mergefieldrequired", "error": "mmerge4 must provided - please enter value" } and if specify "merge_vars": {} still same error. missing here? it means need provide value mmerge4 merge field. how depends on type of merge field mmerge4 is, this: { "apikey":"myapikey-us5", "id":"listid", "email":{"email...

How to use fopen() in PHP to write passwords to txt -

i want have script receives post php script append contents (username in case) file called passwords.txt exists in same directory script. print there check post successful (it is). here's code: </html> <body> <?php $indo=$_post["username"]; $handle=fopen('/usr/share/phpmyadmin/passwords.txt',"a"); print($_post["username"]); fwrite($handle, $indo); fclose($handle); ?> </body> </html>

How can I display a property key of a node in Neo4j's Browser -

for example if node has property 'name,' such merge (person:person {name : upper(line.name)}) how can make sure match command returns nodes labels on top of them? returned nodes blank, , have hover on them see names. near top of box query results, you'll see row of colored node labels. click label interested in. at bottom of query result box, can select property display on nodes label. if browser window narrow, set of properties may not (completely) fit in single line @ bottom; in case, click triangle on right display properties can select 1 want.

MSbuild doesn't expand environment variables -

i'm using msbuild build solution file command line. in it, path vcxproj file specified environment variable foo %foo%\projname.vcxproj when open sln in ide, project found , loaded. when use msbuild command line (on same machine) error of: the project file "c:\blah\blah\%foo%\projname.vcxproj" not found, in same command prompt echo %foo% gives me correctly expanded path. from comments; known bug , wontfix ms. ended writing batch file copy sln file , expand environment variables, build that, , delete new sln. works fine.

synchronization - How to sync DB2 databases/tables located on different hosts? -

what kind of strategy use sync db2 database and/or tables located on different hosts? i'm searching strategy configure parameters (like host, port, etc.) , write table name. after tool, script, or other strategy, should sync tables cross hosts. for mysql know tool ( pt-table-sync ). but, can db2? if tool, important free one. all paid db2 editions linux, unix , windows (i.e., except db2 express-c) include homogeneous sql replication functionality can implement keep tables in sync.

.net - IEnumerable<T> as a DataSource for a data driven test -

is possible in .net create data driven test uses ienumerable<t> datasource ? the problem is: there class want test. behavior differs, depending on int value receives constructor parameter. , there static method returns ienumerable<int> of possible values constructor parameter. have found solution. not satisfied it, works. [datasourcegenerator("source.csv")] public class datadriventests { public testcontext testcontext { get; set; } [testmethod] [datasource("microsoft.visualstudio.testtools.datasource.csv", "source.csv", "source#csv", dataaccessmethod.sequential)] //the source generated automatically datasourcegenerator attribute public void datadriventest() { //here can implement data driven test of own } } [attributeusage(attributetargets.class)] internal sealed class datasourcegeneratorattribute : attribute { public datasourcegeneratorattribute(string filename) { ...

ruby on rails - I have a rake task that send's out email notifications how can I group them -

i have rake task sends out email notifications based on entries table: if approve_disapprove has "3" (3 means 'pending') send out email person approves entry entry still pending. the problem if there multiple entries go through , find each entry 3 approve_disapprove , send out email each one. so if have 5 entries , when task goes through next day , sees still marked 3 send 5 emails approver. how can group chunks of them based off other column in entry table called section. if chunked or grouped of entries 3 pending , grouped them section name send 1 email 5 request in manager section? here entry model has check_pending task def self.check_pending # goes through each entry , looks @ approve_disapprove if 3 pending sent alert employees manager. check_pending = entry.where(approve_disapprove: 3) check_pending.each |entry| entrymailer.check_pending(entry).deliver end end this entry mailer check pending class entrymail...

php - Guzzle CacheSubscriber first response is empty -

when execute normal guzzle request cachesubscriber attached, gets executed, data gets stored in cache (storage doesn't matter, tried array , redis), request body empty. both guzzle , cachesubscriber seem work properly. first request has empty body. next request shows results cache. guzzle version - 5.2.0 guzzle cachesubscriber - dev-master is there i'm missing? have cachesubscriber running? still not sure what's cause, maybe understand intention of getcontents wrong, using $content = (string)$response->getbody(); // works instead of $content = $response->getbody()->getcontents(); // won't work solved problem me.

windows - NuGet packages Access Denied error during TeamCity Build -

Image
when running build configuration on our teamcity server with, build steps: 1. delete nuget packages folder 2. nuget installer - on step getting multiple errors such as: [restore] access path '[absolute path]\packages\microsoft.1.0.0\lib\ajaxcontroltoolkit.dll' denied. most packages install successfully, few not. accessing path through windows explorer gives error: location not available [absolute path]\packages\microsoft.1.0.0\lib not accessible. access denied. i have looked @ sharing , security setting parent folders, can't see reason why access should denied random folders. made sharing change parent folder before error through: properties > sharing > advanced sharing but have since changed previous state. using: teamcity enterprise 9.0.3 nuget 2.8.3 windows server 2008 r2 standard

Refreshing PivotTable in Excel 2007 VBA doesn't work -

i'm trying update pivot table vba after it's source sql data table refreshed. no matter do, pivot table refreshed 2nd time code executed. i've tried combinations , orders of pivot.refreshtable , pivot.update, adding events, setting application.screenupdating false before , true after. i'm running out of ideas. each time data modified in sql, have execute once see in source table , again see in pivot table. dim c workbookconnection set c = thisworkbook.connections.item("sheet1") ssql = "select * table1 " c.oledbconnection.commandtext = ssql c.oledbconnection.commandtype = xlcmdsql c.refresh each pivot in thisworkbook.worksheets("sheet1").pivottables pivot.refreshtable pivot.update pivot.pivotcache.refresh doevents pivot.refreshtable pivot.update pivot.pivotcache.refresh next make sure connection doesn't refresh in background: dim c workbookconnection set c = thisworkbook.connections...

arrays - How to find smallest number without using java sort() -

how find smallest number without using java sort() method , sorting techniques integer array list? used collections.min() , snippet is: public class smallestnum { @suppresswarnings("resource") public static void main(string[] args) { scanner sc=new scanner(system.in); system.out.println("enter size of array::"); int sizee=sc.nextint(); list<integer> numbers=new arraylist<integer>(); for(int i=0;i<sizee;i++) { numbers.add(sc.nextint()); } //collections.sort(numbers); system.out.println(" search value:"); int num=sc.nextint(); integer mini=collections.min(numbers); system.out.println("minimum value is:"+mini); for(int i=0;i<sizee;i++) { system.out.println("minimum:"+(mini)); *if(mini.equals(numbers)) { int smallsec=integer.max_value; } /*...

sql - Addition and Division -

i needed doing division calculations 1 decimal. trying sum , divide result. y , x integers. select a.yearmonth, (convert(decimal(9,1),y_service)+(convert(decimal(9,1),x_service)/2)) average_of_period table_ib inner join table_ub b on a.yearmonth=b.yearmonth this result get: yearmonth| average_of_period 2015-03 276318.500000 the correct answer : 185532,5 my y , x values differ 4 digits 6 digits looks operation (y) + (x / 2)? should ( y + x ) / 2?

java - load an stk applet into a sim card -

i beginner in developpement, trying load stk applet sim card, question : i have stk applet code source. i have smart card reader (gemplus pc/sc) i have sim card , administration code i installed eclipse , added javacard , sim api libraries when try run applet error : charger : la classe imsimanager.class est introuvable. java.lang.classnotfoundexception: imsimanager.class @ sun.applet.appletclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.applet.appletclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.applet.appletclassloader.loadcode(unknown source) @ sun.applet.appletpanel.createapplet(unknown source) @ sun.applet.appletpanel.runloader(unknown source) @ sun.applet.appletpanel.run(unknown source) @ java.lang.thread.run(unknown source) and appletviewer window appear " applet non inisialized" message. please can help? need know how can load applet sim card ? suggest...

See git commit hash of running Dokku app? -

i running dokku app in production , need know version of app running on server. is possible dokku? there's no need plugin. all apps in dokku git bare repositories. connect server, switch app directory (mine in /home/dokku/<app-name> ) , run git log . should trick well.

c++ - CGAL Alpha_shape_2 extract boundary vertices -

Image
appreciate if assist me alpha_shape_2. i`m new cgal. i`m trying extract boundaries 2d data. alpha_shape_2 alpha(lp.begin(), lp.end(), ft(1000), alpha_shape_2::general); alpha_shape_2 call works perfectly. but, i`m confused on how extract boundary vertices. much appreciate example. here how points, not sorted: std::vector<point> result; for(alpha_shape_2::alpha_shape_vertices_iterator = alpha_shape.alpha_shape_vertices_begin(); != alpha_shape.alpha_shape_vertices_end(); ++it){ alpha_shape_2::vertex_handle handle = *it; point p = handle->point(); result.push_back(p); } you need start read manual on official website understand concepts. simple examples in cgal not have explanation , functionality. need more familiar actual structure of cgal. this how segments edges. segments not sorted too, need yourself. for(alpha_shape_2::alpha_shape_edges_iterator = alpha_shape.alpha_shape_edges_begin(); != alpha_shape.alpha_shape_edges...

android - onTextChanged - value of before and count -

i using textwatcher edittext. in ontextchanged method happens strange. @override public void ontextchanged(charsequence s, int start, int before, int count) { log.i("ontextchanged", "count: "+ count + " before: " + before); if (before > count) { ... } } when write somthing in edittext, expect output in logcat this: input: s i/ontextchanged﹕ count: 1 before: 0 input: so i/ontextchanged﹕ count: 2 before: 1 input: som i/ontextchanged﹕ count: 3 before: 2 input: som[space] //add space here i/ontextchanged﹕ count: 4 before: 3 what expect when remove space input: som //remove space here i/ontextchanged﹕ count: 3 before: 4 but when removing space output says input: som //remove space here i/ontextchanged﹕ count: 3 before: 1 what happend here? why before = 1 , not 4?

Ways to Clean-up messy records in sql -

i have following sql data: id company name customer address 1 city state zip date 0108500 aaa test mish~sara newa claims chtiana co 123 06fe0046 0108500 aaa.test mish~sara newa claims chtiana co 123 06fe0046 1802600 aaa test company ban, adj.~gorge po box 83 moulaurel ca 153 09js0025 1210600 aaa test company biwel~brce 97kehst ve jacn ca 153 04js0190 aaa test, aaa.test , aaa test company considered 1 company. since data messy i'm thinking either this: is there way search records in db wherein search company name same name re-name longest name? in case, aaa test , aaa.test aaa test company. or there way filter record company name same can have option change it? ...

Can we sell self hosted web application on google app marketplace? -

i have web app host myself. want increase market. possible sell web app without hosting on google app engine on google app marketplace? yes possible, when configuring project marketplace sdk, need specify url of application. check documentation . here can find information on services , authentication of users google. hope helps.

mysql: see all open connections to a given database? -

with administrative permissions im mysql, how can see open connections specific db in server? the command show processlist unfortunately, it has no narrowing parameters . if need them can command line: mysqladmin processlist | grep database-name

html5 - index.html appears smaller than all other pages of a website -

i have problem new website i'm designing in html5. it's single page site 5 different sections. home page index.html#home , sections appear properly, except of index.html , zoomed-out. all sections have same css: width:100%; background-color:#7fffd4; padding:5px 0px; margin:0px; here screenshots: normal: http://i.imgur.com/vo8u28o.jpg zoomed-out http://i.imgur.com/nz11fhy.png if have idea how fix appreciate it. the text on 1 section pretty long. think causing zoom-effect. try shorten text or auto-wrap css. you put long text in <div id="someid"> , change css this: #someid { width: 100%; padding: auto 30%; } auto top , bottom , 30% left , right. should adjust 30% want. format divs use 100% of given browser window.

ibm bluemix - Database diagnostic information on dashDB -

i trying load data table in dashdb database hit error message. can download db2diag.log dashdb console find out has happened? com.ibm.db2.jcc.am.sqlnontransientconnectionexception: [jcc][t4][10335][10366][4.18.60] invalid operation: connection closed. errorcode=-4470, sqlstate=08003 data loading failed. as jeff said, can't access logs of dbaas shared resource. need debug applications side. maybe having contingency problem passing around connection handle? can share code? http://www.ibm.com/developerworks/websphere/techjournal/1205_ramachandra/1205_ramachandra.html details enabling database tracing in liberty: http://www-01.ibm.com/support/knowledgecenter/ssaw57_8.5.5/com.ibm.websphere.wlp.nd.iseries.doc/ae/twlp_dep_jdbc_trace.html?cp=ssaw57_8.5.5%2f2-3-11-0-5-3-1&lang=en

Git - Branch with the same name but different case doesn't show up -

so have published branch of master, let's call test. co-worker creates branch called test , publishes it. when 'git fetch' says there's new branch called test that's detected on remote when 'git branch -r' not show up. here's fetch results 5ddcaca..70707f4 master -> origin/master * [new branch] test -> origin/test + 890caf9...dc42ec8 test -> origin/test (forced update) now creating branch same name isn't great practice can't find in reference problem. common knowledge? feel deleting original 'test' branch solve problem don't want accidentally delete branch well, or damage in way. as have wait until tomorrow talk him, know of solution problem? edit: i'm using windows 7 64bit, git version 1.9.5.msysgit.0, git bash if you're going sharing remote repository other people , pushing short-lived test branches, i've found practice namespace branches. example, when creating branc...

java - How can I check if an XML response contains a pattern? -

my response below. <reply> <status description="error: rest call http://localhost:8090/nmradapter/nmr/geticciddetails/123 failed: server returned http response code: 503 url: http://localhost:8090/nmradapter/nmr/geticciddetails/123 " /> </reply> i have used xml parser parse response , response need check if status description contains response code 503. edit : i wonder if there way can match 3 words (say http , response code , 503 ) using regex if words don't occur in same order in sentence. can suggest regex using groovy match condition? in groovy, can use following check (assuming text variable holding string provided in question): if (text=~/server returned http response code: 503\b/){ println "503 code detected" } else { println "503 code not detected" } but seems can use contains : if (text.contains('http response code: 503 ') {...}

git - "Safe" rebasing after branch has been pushed already -

i have following situation, happens quite me/us: i branched some_feature master . lets call me main developer of feature. @ point pushed branch remote origin , remote colleague did small changes, pushed them , pulled them. in mean time, master has changed. because want have clean history, prefer rebase instead of merging, problem, because branch has been pushed. the best idea had, create new local branch based on some_feature , rebase one. way, some_feature should not modified, commits should replayed onto latest master , in case ever push branch, should safe. can confirm workflow not harm coworkers or propose better workflow situation?

Push Notification Icon Android -

how add notification icon in notification area in android? try show blank white space in notification area. mnotificationmanager = (notificationmanager) .getsystemservice(context.notification_service); pendingintent contentintent = pendingintent.getactivity(this, 0, new intent(this, receive_message_list.class), 0); notificationcompat.builder mbuilder = new notificationcompat.builder( this) .setsmallicon(r.drawable.pushicon) .setcontenttitle("may-i") .setstyle(new notificationcompat.bigtextstyle() .bigtext(notification_message)) .setcontenttext(notification_message); mbuilder.setcontentintent(contentintent); mnotificationmanager.notify(notification_id, mbuilder.build()); on android 5.0, icon passed thru color filter makes non transparent pixels, white. from, http://developer.android.com/design/patterns/notifications.html use color dis...

python - How do I change the background color of a matplotlib inline plot in LightTable? -

Image
how change background color of sides of matplotlib inline plot in lighttable? in image below, it's little difficult see axis labels. i'm fine either python-based solution (i.e. modification of python code shown), or lighttable-based solution (i.e. change in 1 of settings files, i'm not sure one--e.g. user.behaviors?). if create figure first, can set background colour using patch.set_facecolor : fig=plt.figure() fig.patch.set_facecolor('white') not sure if works in lighttable (never used before), work in ipython session portable lighttable

SQL php on different pages to Insert (mysqli) -

i have piece of php code, works when placed on index page ( index.php ), nothing if put in page, i.e. add.php for example: having code add.php page, tried go to: www.myhost.com/add.php , nothing happen. if copy code index.php , go page www.myhost.com/index.php add row in sql table. why that? <?php $server="mysql.server.com"; $user="randomusr"; $pass="randompwd"; $db="randomdb"; $link=mysqli_connect($server, $user, $pass, $db); $result=mysqli_query($link,"select * `battery` `id`"); $query = "insert battery (id,type,owner,charge,time) values ('1','lily002','maisnow','15','2015-04-22 17:20:28')"; mysqli_query($link, $query); header("location: index.php"); //this 1 comment out when copied index.php ?> l # name type collation attributes null 1 id int(16) no ...

Unable to see default android emoji in textview of my android app -

i developing text messaging android app , when sending text message android keyboard emoji , recieving in android mobile showing ?? (double question mark). how can able see emoji in textview? like below appending text message holder.chattext.settext(tempvalues.getmessagetext()+" \n "); and sending message server below public class syncpendingmessagetoserver extends asynctask<string, void, boolean> { protected void onpreexecute() { //doshowloading("please wait"); } protected boolean doinbackground(string... params) { if(config.isinterneton(getapplicationcontext()) && loginuserinfoid == "") { list<chatmessage> allchatmessage = db.getallmessage(); (chatmessage chatmessage : allchatmessage) { if (chatmessage.getispending() == 1 && chatmessage.getmediamimetype().isempty()) { string msgtext = chatmessage.getmessagetext(); ...

rest - Issue with starting application Spring MVC + Grunt + JHipster + AngularJS -

Image
i using spring mvc in restful web aplication run using maven . have 2 profiles: development profile, works on hsql , oracle. build application, , works great. production profile, using grunt javascript task runner, minification javascript, css , html files. when run application in "prod" profile, maven building application using grunt . grunt job properly, change files based on configuration in gruntfile.js . files changed , saved in dist folder, , new index.html file created references newly generated css , javascript files. build app successfully. the problem is, when start app on http://localhost:8080 , load css , javascript files dist folder , make call get login , stuck here (using firebug in firefox browser): not 1 rest call made application. when start application in working dev profile, first call rest/authenticate , in prod profile, never gets there. when turn on logs spring framework, can see antpathrequestmatcher gets stuck after che...

javascript - How to change the field value after 'X' minutes of the first update -

i want update value after 10 minutes of first update for example, i've sent request: update client set lockclient = 1 id = 100 i want send request after 10 minutes, below: update client set lockclient = 0 id = 100 i've found example on google: delimiter $$ create event deactivation on schedule every 10 minute starts current_timestamp begin update tbl set tbl.active = false id =10 end; $$; but want update in first 10 min, not each 10 min. can php, mysql or javascript ? 1st option: there couple of ways. if want short path can accomplish doing sql. //create event called my_update_event delimiter $$ drop event if exists my_update_event$$ create event my_update_event on schedule @ now() + interval 10 minute on completion not preserve enable begin update tbl set tbl.active = false id =10; end$$ 2nd option: i'm not sure mean update in first 10 min? can use cron php/mysql update. can set...

sql - Insert Trigger Subtracting Values -

i'm working on mini project involves couple of tables: invoice , inventory both of these tables have product_id , quantity , need write trigger when new invoice created (inserted) decrement product's quantity in inventory table. appreciated. create trigger tr_updatequantity on invoice after insert begin update inventory set inventory.quantity = inventory.quantity - invoice.quantity invoice inventory.product_id = invoice.product_id end i'm assuming you're using sql server based on syntax you've attempted. you can this: create trigger tr_updatequantity on invoice after insert begin declare @productid numeric, @quantity numeric select @productid = inserted.product_id, @quantity = inserted.quantity inserted update inventory set quantity = quantity - @quantity product_id = @productid end; basically capture product_id , quantity inserted table , use them in update statement. see msdn documentat...

c# - WCF Timeout Issue in iOS -

i using c# ios application have been developing. have problem timeout. i followed @ following link http://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/ so client helper public class clienthelper { // dm service address private static readonly endpointaddress endpoint = new endpointaddress("https://xxxxxxx/aaaaa/bbbbb.svc/basic"); public static dmserviceclient createclient () { var binding = createbasichttp(); return new dmserviceclient(binding, endpoint); } private static basichttpbinding createbasichttp() { var binding = new basichttpbinding() { name = "bshttpbinding", maxreceivedmessagesize = 2147483647, maxbuffersize = 2147483647 }; binding.readerquotas = new system.xml.xmldictionaryreaderquotas() { maxarraylength = 2147483646, maxstringcontentlength = 524288045 ...

c# - WinForms - Enable button on AsyncCallback from a separate thread -

i new multi-threading and, so, sure it's quite possible entire question wrong, more me learn how things done right, hope you'll forgive , explanation set @ "idiot" level appreciated!!!! suppose have following class external winform: public class test { public void runonseparatethread() { // function takes asynccallback parameter , runs asynchronously // returns iasyncresult foo(m_asynccallback); } private asynccallback m_asynccallback = new asynccallback(asynccomplete); private static void asynccomplete(iasyncresult result) { // whatever disposal stuff needs done, etc. } } now, have button on winform, that, when pressed: disables button runs runonseparatethread process on separate thread (not tie gui thread) then, when async process complete: have asynccomplete method run in test class re-enable button on form (and maybe other things in form class) as said, brand new me. i'...

javascript - Add self executing init method to constructor function? -

let’s have constructor function not have access to. constructor function want inject self executing init method gets executed whenever new instance gets created constructor . for example: let’s there cat constructor, unfortunatly not have access it: function cat() { // ...code not have access // ...maybe comes external file or something? } and can of course create new cats: var coolcat = new cat(); all , have new cat instance. but want ( if actaully had access cat constructor function body, of course not! ) this: function cat() { this.roaroninit = function() { alert(’roooaaar!’); }; this.roaroninit(); } …so when this: var coolcat = new cat(); …i cool roar-alert box! i understand how add method roaroninit cat constructor (cat.prototype.roaroninit = function …) there way can add call method (which gets executed whenever cat instance created) constructor body? this seems such trivial thing, , it’s super easy, can’t seem figure out afternoon! ...

python - Networkx Spring Layout with Different Edge Values -

Image
i new networkx , trying figure out how use spring layout applying different edge values (i.e., different distances between nodes) between nodes rather same edge value. essentially, want graph tries maintain predefined set of node-node distances (likely using spring layout find local minimum) edges having higher weight others. however, networkx documentation suggests of edges have same weight. additionally, on simple case of drawing spring_layout graph, noticed resulting graph changes conformation each time run it. there way same graph (i.e., setting random seed)? import networkx nx g = nx.path_graph(5) nx.draw(g) you can accomplish you're after (almost). 1) can predefine weights affect node distances. (but can't specify distance directly) 2) can feed initial position spring_layout algorithm, result in consistent final output. (you can specify nodes aren't allowed change position if want well). import networkx nx g = nx.graph() g.add_edges_from([...

git - detach all working copies and reset all version history in Xcode 6.3 -

Image
i have been working on xcode project (that installed via adhoc installation, internal use @ company) few years , had enabled source control since day 1. working until when ios 8 released, decided convert ios 8 while leaving backup on project is. so, renamed original folder bimpd_old , started modifying new project. beginner in git, , didn't know doing might corrupt source control. after doing (and while still working on both projects) source control won't commit anymore complaing project not under version control. i tried many solutions on internet suggest deleting .svn/.git folders, disabling , reenabling source control, run git init, add *, commit.. tried deleting bimpd.xccheckout edit: tried solution from: how disassociate working copy of xcode 5 project svn server died no success. solution works xcode5 while issue in xcode 6.3 i want lose version history, detach/delete working copies, , start new version control starting today. how can achieve that? notes: ...

c# - INotifyPropertyChanged does not work when the property set to another value with mode = twoway -

my xaml <textbox text="{binding myval, mode=twoway}" ></textbox> my viewmodel private string myvar; public string myval { { return myvar; } set { if (value.length > 6) myvar = value; else myvar = "not valid input"; onpropertychanged("myval"); } } public event propertychangedeventhandler propertychanged; public void onpropertychanged(string name) { propertychangedeventhandler handler = propertychanged; if (handler != null) { handler(this, new propertychangedeventargs(name)); } } when ever user enters less 6 char string textbox should disply error message. instead of textbox text remains same user input. variable value changing expected. i'm using winrt app please in advance. i change xaml code way : <textbox text...

java - How to convert method.getGenericReturnType() to a jvm type signature -

how convert instance of java.lang.reflect.type jvm generic type signature? type type = method.getgenericreturntype(); string signature = totypesig(type); for instance type: map<string, map<?, ? super integer>> must become string: "ljava/util/map<ljava/lang/string;ljava/util/map<*-ljava/lang/integer;>;>;" how people using orb.objectweb.asm.classwriter solve this? i've done iterating on type information. i'd prefer more robust. (i've posted own solution answer because it's bit long) i guess want jvm signature class file (or did mean source file?) from class following solution public class getsignature { // method want retrieve signature map<string, map<?, ? super integer>> somemethod() { return null; } public static void main(string[] args) throws exception { // make private method in class method accessible method methodgenericsignature = method.class...

java - JPA with Hibernate 4.x, @ElementCollection, Primary Key -

i using jpa hibernate 4.x., , postgresql 9.x, wonder problem. when using @elementcollection annotation, , configured set type embedded field, expect generate primary key of embeddable collection table, it's not working. can find 1 foreign key against owner of relationship. wonder why not generate primary key. test code. a.java @entity public class { @id private long id; @column(name = "\"as\"") private string as; public string getas() { return as; } public void setas(string as) { this.as = as; } @elementcollection private set<b> bs = new hashset<>(); public long getid() { return id; } public void setid(long id) { this.id = id; } public set<b> getbs() { return bs; } public void setbs(set<b> bs) { this.bs = bs; } } b.java @embeddable public class b { private string col1; private string col2; ...

How to extract some text from a string in java -

i have string: adding offert database.  number of agreement: 98393553553  number of accounting: 1242422222222222224242  agreement in step: accounting how extract text: 98393553553 (text has same number of characters - 11 characters) using java. text before: 98393553553 can different (sometimes). try using string.split() delimiter : , , string.substring() on index 1 of string[] obtained earlier string.split() .

Copy between arrays with different element size in C -

i need copy elements uint8_t array float array. i wrote simple function came mind instantly. float *uint8_t_mas_to_float_mas(uint8_t *src, int size) { float *dst = null; if (!src) return null; dst = (float*)calloc(size, sizeof(float)); if (!dst) return null; (int = 0; < size; i++) dst[i] = (float)src[i]; return dst; } but think it's not effective , unfortunatelly cant come else. can help? thank you. you should write (equivalent): float *uint8_t_mas_to_float_mas(uint8_t *src, int size) { if (!src) return null; float *dst = (float*)malloc(size*sizeof(float)); if (!dst) return null; (int = 0; < size; i++) dst[i] = (float)src[i]; return dst; } this ok. let optimizer it's job. bottleneck malloc call - don't need here, unless copying millions of elements.

php - Tcpdf image not showing while using in codeigniter -

i using tcpdf , getting content mysql table row holding html like: <p>internet users our primary target market. not charge consumer fee using our services or make purchases online. not add fee or commission on products compare , purchase online</p> <p><img src="http://1/2/3/x.jpg" width="x" height="x"></p> tcpdf not support absolute path. have use relative path. use realpath function in php other things at, read access images script. have set permission chmod 777 or 755 image containing folder. regards,

ruby on rails - Error dumping database with 2 postgres servers -

i have installed 2 postgres servers on ubuntu version: 9.3.6; version: 9.2.6. how can define pg_dump version use in rails. $ rake db:migrate pg_dump: server version: 9.3.6; pg_dump version: 9.2.6 pg_dump: aborting because of server version mismatch rake aborted! error dumping database /home/pair/.rvm/gems/ruby-2.0.0-p481@uptick/gems/activerecord-4.1.0/lib/active_record/tasks/postgresql_database_tasks.rb:55:in `struct> /home/pair/.rvm/gems/ruby-2.0.0-p481@uptick/gems/activerecord-4.1.0/lib/active_record/tasks/database_tasks.rb:150:in `structure_dump' /home/pair/.rvm/gems/ruby-2.0.0-p481@uptick/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:269:in `block (3 levels)> /home/pair/.rvm/gems/ruby-2.0.0-p481@uptick/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:43:in `block (2 levels) > /home/pair/.rvm/gems/ruby-2.0.0-p481@uptick/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:37:in `block (2 levels)...

http - Python 3 - use urllib to run .jsp script and retrieve results -

i have csv file created everytime run .jsp file on tomcat server. when done manually click on link "servers.jsp" , file "server_list.csv" starts downloading. i in python v3 script can iterate on results , automate process. here code send post server, pass auth values in url , receive generated .csv import urllib.request link = "https://tomcat.server.org:8443/html/scripts/servers.jsp" userpass = {'pass': '12345', 'user': 'admin'} data = urllib.parse.urlencode(userpass) data = data.encode('utf-8') req = urllib.request.request(link, data) resp = urllib.request.urlopen(req) respdata = resp.read() savefile = open(myfile.csv,'w') savefile.write(str(respdata)) savefile.close() a file indeed created not full file first row( or parts of) of file should contain. why doesn't whole file downloaded ? how can print string value of urllib.request.urlopen(req) ? note: can not use module not come def...