Posts

Showing posts from May, 2013

python - Load scikit-learn library without installing it -

my problem : have script needs scikit learn 0.17 library. have deploy application use script on server on not allowed install anything. know scikit learn 0.15 installed on server. know there stuff topic on stackoverflow, i’m noob , i’m stuck. my question : see how possible load scikit learn 0.17 package without installing it? check site: https://try.jupyter.org/ contains interpreter numpy, scikit , goods. upload code , enjoy.

powerbuilder - How to import Excel file into DataWindow -

i want import .xlsx file powerbuilder datawindow, know can able csv format, user wants use xlsx format, please let me know if there options import. you can import xls (this our import function). of course have know put each columns value excel datawindow. think not need such sophisticated solution, there main guidelines: int li_rtn, li_i string ls_range long ll_excel_rows, ll_max_rows, ll_max_columns long ll_i, ll_j string lsa_column_names[], ls_mod long lla_column_pos[] long ll_row int li_rc string las_truncated_data[] string ls_errormessage oleobject lole_excel, lole_workbook, lole_worksheet try lole_excel = create oleobject li_rtn = lole_excel.connecttonewobject("excel.application") if li_rtn <> 0 ls_errormessage = "error running ms excel api" li_rtn = -1 else li_rtn = 1 lole_excel.workbooks.open(as_filepath) lole_workbook = lole_excel.application.wo...

c++ - Correctly using atomic<T> -

i struggling writing lockless code atomic variables c++11 thread pool class based on https://github.com/nbsdx/threadpool . here modified class: class threadpool { public: explicit threadpool(int threadcount) : _jobsleft(0), _bailout(false) { _threads = std::vector<std::thread>(threadcount); (int index = 0; index < threadcount; ++index) { _threads[index] = std::move(std::thread([this] { this->task(); })); } } void addjob(std::function<void(void)> job) { { std::lock_guard<std::mutex> lock(_queuemutex); _queue.emplace(job); } { std::lock_guard<std::mutex> lock(_jobsleftmutex); ++_jobsleft; } _jobavailablevar.notify_one(); } void joinall() { if (!_bailout) { _bailout = true; _jobavaila...

ios - how to call any method when user tocuhes any part of the screen in ipad -

i have ipad app in want if user touches part of screen should show alert. have studied method touch started , ended point how call method on touch if user touches screen. you looking this: uitapgesturerecognizer *singlefingertap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(handlesingletap:)]; [self.view addgesturerecognizer:singlefingertap]; //the event handling method - (void)handlesingletap:(uitapgesturerecognizer *)recognizer { cgpoint location = [recognizer locationinview:[recognizer.view superview]]; //do stuff here... }

User interface for opengl project? -

im working on opengl project solar system using visual c++. done quite bit of coding, need implement user learning module, includes overview button, stop button , info button. want make form, panel containing buttons , panel viewing animation. tried using glui it's not useful implementation. possible create form in visual studio, , import code in panel function? have considered using qt gui portions of project ? can create panel qt buttons , guis. use qglwidget panel view animation. a tutorial using qt creator opengl ( http://www.youtube.com/watch?v=1nzhsky4k18 ). there many examples of opengl + qt + visual studio in "c:\qtinstallpath\examples\opengl" directory. if wanted didn't want use qt use c++\cli assist gui portions of code. following link shows how create opengl view on windows form in managed c++. http://www.codeproject.com/articles/16051/creating-an-opengl-view-on-a-windows-form .

asp.net mvc - How to use Power BI Desktop without uploading data into its could -

i want use power bi desktop within mvc application. find coupled uploading data [1] , [2] cloud not option me since working sensible company data. there workaround know off? and if not there alternatives? i think might looking using power bi gateway . create connection local data stores. in order display power bi report inside mvc application still need create pbix , upload power bi service. using gateway allow direct queries local data, , not force store data in cloud. once have report uploaded powerbi service can follow article here on how embed tile or report application. i have been able embed report mvc application using above article, have not tried out gateway because data lives in azure. hope helps.

Error: Syntax error: type expected ocaml -

i'm new ocaml. following error when trying execute code. let rec parser (edge_lst : edge list) (mininode_lst: mininode list) (previousnode : mininode) (s_lst: stmt list) = match s_lst | [] -> (*no more statements => add stop node , save graph*) (edge_lst,mininode_lst) | hd :: tl -> let currentnode = createnode(hd) in let mininode_lst_new = mininode_lst@[currentnode] , edge_lst_new = edge_lst@[createedge(previousnode,currentnode) in parser edgeplst_new mininode_lst_new currentnode tl; error: syntax error: type expected. please let me know going wrong here. you using list instead of list in definition of parser, ']' missing (you have 1 open bracket without closed bracket). , createedge works on tuple ? believe not, , syntax should (with close bracket) : edge_lst_new = edge_lst@[createedge previousnode currentnode] in

jquery - How to add Show All and hide All in colvis code -

i have code colvis. work fine. <script> $(document).ready( function () { var table = $('#record_fpa1').datatable( { "sdom": 'r<"h"lfr>t<"f"ip>', "bjqueryui": true, "spaginationtype": "full_numbers" }); var colvis = new $.fn.datatable.colvis( table ); $( colvis.button() ).insertafter('div.info'); }); </script> my problem want add additional button inside above code show , hide colvis data table not working. code below: $(document).ready(function() { $('#example').datatable( { dom: 'c<"clear">lfrtip', columndefs: [ { visible: false, targets: 2 } ], colvis: { restore: "restore", showall: "show all", shownone: "show none" } }); }); how combine...

highcharts - How can i create doughnut chart using oxyplot in xamarin.android? -

i need create app shows chart highcharts. did't library that. i'm using oxyplot create charts. have create pie chart using oxyplot this. var plotview = new plotview (this); plotview.model = pieviewmodel(); this.addcontentview (plotview, new viewgroup.layoutparams (viewgroup.layoutparams.matchparent, viewgroup.layoutparams.matchparent)); public plotmodel pieviewmodel() { var modelp1 = new plotmodel { title = "pie sample1" }; dynamic seriesp1 = new pieseries { strokethickness = 2.0, insidelabelposition = 0.8, anglespan = 360, startangle = 0 }; seriesp1.slices.add(new pieslice("africa", 1030) { isexploded = false, fill = oxycolors.palevioletred }); seriesp1.slices.add(new pieslice("americas", 929) { isexploded = true }); seriesp1.slices.add(new pieslice("asia", 4157) { isexploded = true }); seriesp1.slices.add(new pieslice("europe", 73...

ruby on rails - add devise:confirmable to 2 models -

can give me example of how add devise 2 different models existing databases,i have 2 models, customer , vendor.if add :confirmable on both models , migration rails g migration add_confirmable_to_devise confirmable option included in both models after migrate database? no have create 2 separate migrations: rails g migration add_devise_fields_to_customer class adddevisefieldstocustomer < activerecord::migration def change # confirmable columns add_column :customers, :confirmation_token, :string add_column :customers, :confirmed_at, :datetime add_column :customers, :confirmation_sent_at, :datetime add_column :customers, :unconfirmed_email, :string end end rails g migration add_devise_fields_to_vendor class adddevisefieldstovendor < activerecord::migration def change # confirmable columns add_column :vendors, :confirmation_token, :string add_column :vendors, :confirmed_at, :datetime add_column :vendors, :confirmation_sen...

c# - Reading .xps file causes OutOfMemoryException -

when use c# read .xps file, outofmemoryexception . got information opening xps document in .net causes memory leak , seems not work in code. my code below: using (xpsdocument document = new xpsdocument(xpspath, system.io.fileaccess.read)) { fixeddocumentsequence fds = document.getfixeddocumentsequence(); int pagecount = fds.documentpaginator.pagecount; (int = 0; < pagecount; i++) { documentpage source = fds.documentpaginator.getpage(i); visual v = source.visual; fixedpage fixedpage = (fixedpage)v; fixedpage.updatelayout(); } document.close(); } when remove line fixedpage.updatelayout() . through win8's "task manager", current program's use of memory increased 10mb each time while read 1 .xps file. when add line, use of memory still increased 1mb each time. any 1 can me?

How can I Monitor External files in Java -

i have .exe file, takes .txt file input , returns .txt files outputs. i have 2 folders names inputfiles , exefolder . inputfiles folder have many number of input files, files passing argument .exe file. exefolder have .exe file, output files , 1 input file(we file inputfiles folder). i want build 1 web application, work in following way. step 1 : it checks, how many no of files available in sourcedirectory far requirements.generally every time want find .txt files code maintenance passed filetype argument function. for this,i wrote following code,it's working fine public list<file> listoffilenames(string directorypath,string filetype) { //creating object file class file fileobject=new file(directorypath); //fetching filenames under given path file[] listoffiles=fileobject.listfiles(); //creating array saving filenames, satisfying far our requirements list<file> filenames = new arraylist<file>(); (int f...

.net - Crystal report is not poping up -

i created .net web application printing in document. created stored procedure dataset created dataset , loades procedure created crystal report loads dataset crystal report , arranged in crystal report created crystalreportviewer1 now want call crystal report while pressing 'button 1' facing difficulty protected sub button1_click(byval sender object, byval e eventargs) handles button1.click dim cryrpt new cr_agreement cryrpt.load("@c:\users\emarketing\documents\visual studio 2010\projects\arc\arc\crreports\cr_agreement.rpt") crystalreportviewer1.reportsource = cryrpt end sub try refreshing viewer after set report source. protected sub button1_click(byval sender object, byval e eventargs) handles button1.click dim cryrpt new cr_agreement cryrpt.load("@c:\users\emarketing\documents\visual studio 2010\projects\arc\arc\crreports\cr_agreement.rpt") crystalreportviewer1.reportsource = cryrpt crysta...

sql - The maximum column value of all tables -

Image
it's possible add below script max value of 1 specific column (each have column same name): select owner, table_name, round((num_rows*avg_row_len)/(1024*1024)) mb, num_rows "rows", last_analyzed --max(data_for_each_column) all_tables owner = 'oap' order table_name asc if tables have 1 common column, can use hack xml dynamically create select max() each table: select owner, table_name, round((num_rows*avg_row_len)/(1024*1024)) mb, num_rows "rows", last_analyzed, dbms_xmlgen.getxmltype('select max(id) m '||owner||'.'||table_name).extract('//text()').getnumberval() max_id all_tables tbl owner = 'oap' , exists (select 1 all_tab_columns ac ac.owner = tbl.owner , ac.table_name = tbl.table_name , ac.column_name = 'id') order table_name asc; you need replace max(id) correct column name. ...

arrays - YUI 3: Set Value to Multiple Select -

i using yui 3, have question yui usage. i have select tag option tags: yui().use( "node", "event", "cssbutton", function(y){ y.one('body').addclass('yui3-skin-sam'); y.one('#btnsel2').on('click',function(){ y.one('#myselect').set('value', '5'); }); }); <select id="myselect" size="10" multiple="true"> <option value="1">apple</option> <option value="2">mango</option> <option value="3">pineapple</option> <option value="4">orange</option> <option value="5">peach</option> </select> <button id="btnsel2" class="yui3-button">set selected</button> the above method cover 1 value, can set multiple value array or string comma delimited? than...

java - Spring DataBinder equivalent for Json -

i working on web project using play framework 2.1.0. play supports decent api parsing form data , mapping model beans directly. looks like, form<employee> form = form.form(employee.class).bindfromrequest(); if (form.haserrors()) { return badrequest(template.render(form)); } this api validations on fly , capable of handling binding failures, when string not converted integer. form api keeps collection of errors mapped name of property. underlying form api, play using databinder of spring's validation framework doing magic. i wondering if there similar binding api convert json bean directly, support handling binding failures? play 2.0 uses jackson internally fails when there binding failures , throws exception. looked @ code , not easy supress these errors. is there framework can satisfy requirement out of box? essentially, need framework convert json java bean, can handle binding failures gracefully. it wonderful if allows me collect them somewhere can g...

apache pig - performance improvement of pig script using python udf -

following pig(0.15) script used mapping inputfile(cdrs alias) other file (mastergt alias) & calling python(2.7.11) udf mapping same, taking 40mins 4.5k records. can please suggest improvement. pig script: register 'smsiuc_udf.py' using streaming_python smsiuc_udfs; cdrs = load '2016040111*' using pigstorage('|','-tagfile') ; mastergtrec = load 'master.txt' using pigstorage(',','-tagfile'); mastergt = foreach mastergtrec generate (chararray) upper($1) opcdpc, (chararray) upper($2) gtoptname,(chararray) upper($3) gtoptcircle; cdrrecord = foreach cdrs generate (chararray) upper($1) aparty, (chararray) upper($2) bparty,$3 smssentdate,$4 smssenttime,($29=='6' ? 's' : 'f') status,(chararray) upper($26) srcgt,(chararray) upper($27) destgt,($12=='405899136999995' ? 'mtsdel-cdma' : ($12=='919875089998' ? 'mtsraj-gsm' : ($12=='405899150999995' ? 'mtschn-cdma...

rational - When reloading an RTC component that is out of sync, receive error "case-sensitive names while loading on a case insensitive platform" -

while reloading project in rtc, following error prevents reload succeeding. there 1 errors. after correcting problems, recommended components reloaded. reload incremental, loading missing items. can further reduce reload time reloading projects out of sync. in order load /myproject/path/filename.png item loaded must deleted. contents being loaded have case-sensitive names while loading on case insensitive platform any ideas how resolve this? additional info: rtc client v3.0.1.5 on windows 7 rtc server v4.0.1 following thread " suggestions rtc naming conventions ", a: delete of file loaded in local worskpace refresh said local workspace , accept stream proposes file checking/commit changes reload everything

java - Recommendation for Logging data in AWS Lambda -

aws lambda supports 2 ways logging , when lambda function written in java. log4j lambdalogger i want know if advantage of using 1 logging scheme on other. thanks! what understood aws lambda java logging , searching around net is log4j pros: can customize logs(using log4j.properties). cons: increase size of jar/zip add more dependency project lambdalogger pros: saves memory embeded on dependencies cons: can't customizable i hope helps!

go - Is it possible for Google App Engine string and integer datastore keys to clash? -

this question has answer here: can use allocateids “string” ? datastore 3 answers i have datastore entity of kind myentity , want use stringid keys , other times use intid keys generated allocateids . can safely mix string , integer ids without worrying string id might surreptitiously overwrite integer id generated allocateids , vice versa? the reason ask because assume string , integer ids use same index. possible accidentally have sequence of bytes represent string id same sequence of bytes represent integer id on same index? or string , integer ids namespaced in way prevent collisions? yes, can safely mix string & int ids same kind - same key ( entity ) can not use both @ same time. there no danger of overlapping. guess under hood use protocol buffers serialize key []byte . i used in production without issues. though maybe not ...

php - Get user birthday Facebook Graph -

i want collect information when user log in through facebook. i'm able information need except users birthday if ( isset( $session ) ) { // graph api request user data $request = new facebookrequest( $session, 'get', '/me?fields=first_name,last_name,birthday,email,gender'); $response = $request->execute(); // response $graphobject = $response->getgraphobject(); $fbid = $graphobject->getproperty('id'); // facebook id $fbfname = $graphobject->getproperty('first_name'); // facebook first name $fblname = $graphobject->getproperty('last_name'); // facebook last name $fbbday = $graphobject->getproperty('birthday'); // facebook birthday $femail = $graphobject->getproperty('email'); // facebook email id $fgender = $graphobject->getproperty('gender'); // facebook gender /* ---- session variables -----*/ $_s...

php - Call to a member function query() WAMP -

this question has answer here: can mix mysql apis in php? 5 answers here php code: include ('dbconnect.php'); $sql = "select * products"; $result = $conn->query($sql); if($result -> num_rows >0){ while($row = $result -> fetch_assoc()){ echo "$row[productid]"."$row[productname]"; }else { echo "0 results"; } $conn -> close(); here dbconn.php code. don't know error is, if in dbconn.php or on other php page. <?php $conn = mysql_connect("localhost","root","") or die (mysql_error()); $conn = mysql_select_db("shoppingcart",$conn) or die (mysql_error()); ?> try this, avoid use of mysql instead of mysqli include ('dbconnect.php'); $sql = "select * your_table"; $result = mysqli_query($conn, $sql)...

sql - Using COUNT Function in Table Joins -

i writing sql code report page that joins 3 tables. here query have written. comm.commandtext = "select count(distinct courses.courseid) coursecount, count(distinct students.studentid) studentcount, count(students.startdate) startcount, school.name, school.startdate, school.schoolfees " + "from schools " + "left join courses on (school.schoolid = courses.schoolid) " + "left join students on (school.schoolid = student.schoolid) " + "where school.active = 1 " + "group school.name, school.startdate, school.schoolfees"; the above query works well. want show count of student.startdate each school student.startdate satisfy condition. here query want use select count(students.startdate) students student.startdate >= dateadd(month, -1, getdate()); i want above query return part of main query dont know how achieve it. appreciated. thanks ...

How to get the Json java object using javascript -

my requirement have put value or list key value pair on json object,for have done on java class not able figure out how retrieve same json object used in java class through java script on jsp page.please me out problem import org.json.simple.jsonobject; class beanmanager{ private jsonobject jsonobject; public jsonobject getjson() { jsonobject=new jsonobject(); jsonobject.put("name","jack daniel"); jsonobject.put("age","3"); } } in jsp attach json content html node , in javascript read node content , evaluate them js object. such solution might usefull temporal only. consider use way

android - Is nullifying every views and listeners a good idea in finding or correcting leaks? -

i working on project , keep seeing methods nullify views , listeners on every ondestroy(). have seen code navigate rootview , set every listener null. the original coder told me has done way prevent leaks, think causing more harm vm. think? in opinion, unnecessary. once activity destroyed (i.e. ondestroy called) views , related listeners qualified garbage collection. however, make sure not treating static activity and/or bound activity's context (that includes views too).

dojo - How to launch GridX column width recalculation after the grid has been started up? -

according documentation: https://github.com/oria/gridx/wiki/create-the-simplest-gridx never forget call grid.startup(), since column width calculation , layout rendering need access geometry information of grid dom nodes. if have grid columns, have no width specified, , autowidth set false , startup() calculates size of columns so, fill whole viewport horizontally. however, if viewport expanded, , empty space inserted after last column. if viewport narrowed, last columns not more visible (and no scroll rendered). so think best workaround launch recalculation of columns sizes manually, after viewport resized. can't find api method that. how call column width recalculation , layout rendering on existing grid? what i've done situation setup event handler watch window resize events, set width current grid width. when creating grid: function _resizetowindow(grid, gridid) { grid.resize({w: dom.byid(gridid).offsetwidth, h: undefined}); } on(window...

App Metric for current user installs for IOS apps. -

Image
i'm searching app metric 'current user installs' ios apps. google play store provide metric android apps. know if metric available ios apps? login itunesconnect under app analytics, can find active devices on metric section. it important remember, active devices opt in only. users have enabled apple collect data, users data shown here.

java - Multithreading "unpredictable" behavior -

this question has answer here: relationship between threads , println() statements 2 answers i going through use cases volatile , have encountered below scenario: private static boolean stop = false; public static void main(string[] args) throws interruptedexception { thread runner = new thread(new runnable() { @override public void run() { int = 0; long start = system.currenttimemillis(); while(!stop){ i++; } system.out.println("i m done after "+(system.currenttimemillis() - start)); } }); runner.start(); thread.sleep(2000); stop = true; } the above code runs indefinitely. fine due hoisting done compiler in attempt optimize code. however, if replace, i++ other statement e.g. system.out.println("hello") . stops after 2 se...

javascript - force-directed d3.js add edge labels -

i want visualize graph in d3js force-directed layout. have been following question , don't work. i created jsfiddle, can found here. however, lines not working, labels how should be. oddly, when execute locally working someday lines shown twice, this: <g class="link-g"> <line class="link" x1="297.0210832552382" y1="122.48446414068198" x2="245.8066880510027" y2="240.1061616356794"></line> <text>interaction</text> <text x="271.4138856531205" y="181.2953128881807">interaction</text> </g> anyway, following. first link , linktext. var link = svg.selectall(".link") .data(links, function(d) { return d.source.id + '-' + d.target.id; }); link.enter() .append("g") .attr("class","link-g") .append("line") .attr("class", ...

c# - How to make a natural-looking list? -

by natural-looking, mean this: item1, item2, item3 , item4. i know can comma-separated list string.join , item1, item2, item3, item4 but how can make sort of list? i've got rudimentary solution: int countminustwo = theenumerable.count() - 2; string.join(",", theenumerable.take(countminustwo)) + "and " + theenumerable.skip(countminustwo).first(); but i'm pretty sure there's better (as in more efficient) way it. anyone? thanks. you should calculate size once , store in variable. otherwise query(if it's no collection) executed everytime. also, last more readable if want last item. string result; int count = items.count(); if(count <= 1) result = string.join("", items); else { result = string.format("{0} , {1}" , string.join(", ", items.take(counter - 1)) , items.last()); } if readability less important , sequence quite large: var builder = new stringbui...

mysql - Sum value by hourly for IST data in UTC database -

my db in utc timezone , data inserting in utc time. want sum values , group hourly ist time data. below, id data_id value servertime 1 2 100 2016-05-02 18:30:54 2 2 100 2016-05-02 18:45:54 4 2 200 2016-05-02 19:00:54 5 2 100 2016-05-02 19:15:54 6 2 100 2016-05-02 19:30:54 7 2 100 2016-05-02 19:40:54 query select sum(value) value, servertime date data_table data_id=2 , servertime between convert_tz('2016-05-03 00:00:01','+00:00', '-05:30') , convert_tz('2016-05-03 10:45:24','+00:00', '-05:30') group year(date),month(date),week(date),day(date),hour(date); above query giving result : 200 500 but expecting output : 600 100 because ist 12 = utc- 05:30 means 18:30 19:30 here query calculating 18:30 19:00 , 19:00 20:00 , 20:00 21:00 not accuracy value. i want calculate value 18:30 19:30 , 19:30 20:30 accuracy value ist time data. how solve th...

google apps script - Set global condtional formatting rules programmatically -

i want set background color of every row in "task" column if "status" column's row not blank. easy setup. setting these rules across numerous columns , sheet 1 sheet 100 can tedious. given sheets have same columns "task" , "status" should possible set conditional rule on every sheet. how can programmatically? you may use script accomplish task. know, there's no way make conditional formatting script, here's issue . can copy formatting: make 1 conditional formatting rule on 'key sheet' run script here's code add script editor: function loopsheetscopyformatting() { var ss = spreadsheetapp.getactivespreadsheet(); var sheets = ss.getsheets(); // define key sheet var keysheet = ss.getsheetbyname('sheet1'); // change your's // define range formatting var rangeaddress = 'a1:a1000'; // change your's var samplerange = keysheet.getrange(rangeaddress); var column = sa...

php mysql json document makeup -

i'm using of code generate json data form mysql table : $sql = "select * u3d15"; $result = mysql_query($sql); $json = array(); if(mysql_num_rows($result)){ while($row=mysql_fetch_row($result)){ $json['title'][]=$row; } } mysql_close($db_name); echo json_encode($json); but json looks like: {"title":[["1","kevin","t0e0gaa"]]} i be: { "title" : "decode json", "id" : 20, "buttons" : [ { "title" : "kevin ", "image" : "t0e0gaa" }, { "title" : "lora ", "image" : "v1awyqr" } ] } how can change makeup of file? setup array formatted results. $json = array(); //create empty array $json["title"] = "decode json"; $json["id"] = 20; $json["buttons"] = array(); //empty nested arra...

How to schedule a service to run in android -

i have service in app make api request , use data supplied in response, there way schedule service run in every hour thank that's how did @ end : calendar cal = calendar.getinstance(); intent intent = new intent(this, proximityalertservice.class); pendingintent pintent = pendingintent.getservice(this, 0, intent, 0); alarmmanager alarm = (alarmmanager)getsystemservice(context.alarm_service); log.d("main",string.valueof( cal.gettimeinmillis())); //make alarm goes off every 10 sec (not exact save battery life) alarm.setinexactrepeating(alarmmanager.rtc_wakeup, cal.gettimeinmillis(), 10000, pintent);

html - WordPress sticky php side bar while scrolling up and down -

i using wordpress has right sidebar. want sticky while scrolling , down. have given css style. sticky now. but, problem shifting it's position right left. here sidebar.php <div class="sidebarsticky col-md-4"> <?php // select widgets include templatepath . '/assets/sidebar/search.php'; if ( is_home()) { // home page include abspath.'/wp-content/ads/300x600_side.php'; include templatepath . '/assets/sidebar/calendar.php'; include templatepath . '/assets/sidebar/featured.php'; include templatepath . '/assets/sidebar/fb.php'; include abspath.'/wp-content/ads/side_3rdparty.php'; include templatepath . '/assets/sidebar/comments.php'; include templatepath . '/assets/sidebar/newsletter.php'; include templatepath . '/assets/sidebar/popular.php'; } elseif ( is_single()) { // single page include abspath.'/wp-content/ads/300x600_side.php'; incl...

javascript - Swap and save background color with jquery -

i have menu on every hover of links background color of page changes. now, let's default index.html color blue, , when hover on , contact have yellow , red. if click on page background color yellow, , if hover on home go blue. happens when mouseout page, background changed blue again, same if i'd hovered on contact. here there's code in js $(document).ready(function() { $('#about').hover(function() { $('body').css('background-color', 'yellow'); }, function() { $('body').css('background', ''); }); $('#contact').hover(function() { $('body').css('background-color', 'red'); }, function() { $('body').css('background', ''); }); and here there menu <a id="about" href="about.html">about</a> <a id="contact" href="contact.html">contact</a> i assume...

osx - What should path be to Julia source file? -

i have .jl file @ /users/myuser/documents/julialearn/julia/mysource.jl in julia repl, i'm trying run as: include("/users/myuser/documents/julialearn/julia/mysource.jl") but error: error: not open file /users/myuser/~/documents/julialearn/julia/mysource.jl in include @ /applications/julia-0.4.5.app/contents/resources/julia/lib/julia/sys.dylib in include_from_node1 @ /applications/julia-0.4.5.app/contents/resources/julia/lib/julia/sys.dylib i tried error similar above: include("~/documents/julialearn/julia/mysource.jl") any idea i'm doing wrong? isomorphic os: cd(joinpath(homedir(),"a_long","path","to_your","files")); include("your_julia_file.jl")

android - GPS coordinates to google map -

i'm working on android application send latitude , longitude "a" activity "b" activity using bluetooth , in "b" activity recieve them simple texts, want convert them location on map. how can this? you may try ... location location = new location(""); // provider name unnecessary location.setlatitude(0.0d); // latitude location.setlongitude(0.0d); // longitude

java - How to give Function Create/Delete/Alter/Execute permission while createing PostgreSQL user -

i want give function create/delete/alter/execute permission user in postgresql while creating function i'm getting error org.postgresql.util.psqlexception: error: must owner of function postgre_proc this procedure/function create or replace function postgre_proc() returns void $$ begin insert mapping_table_test values (11, 'prasad', 24); end; $$ language plpgsql; the error self explainatory. to able create or replace function, need owner of function. using superuser, change ownership of function required user. alter function name ( [ [ argmode ] [ argname ] argtype [, ...] ] ) owner new_owner refer - this

mysql - php insert statement has correct arguments but insert is returning false -

ok insert should fine returning false, $quote holds value have checked. , database here hope pair of eyes can spot this. have been using same insert style other php files, works fine. 1 tricky...issit because of foreign keys? <?php $quote = $_post["quote"]; require "init.php"; $query = "insert `quote`(`quote_description`) values('".$quote."');"; $result = mysqli_query($con,$query); //"insert `quote`(`quote_description`) values ('".$quote."');"; if($result) { $response = array(); $code = "submit_true"; $message = "quote success, click ok continue"; array_push($response,array("code"=>$code,"message"=>$message)); echo json_encode(array("server_response"=>$response)); } else{ $response = array(); $code = "submit_false"; $message = "sorry, server error occurred, please try again"; ...

java - Implement a method that generates the last insert id -

i'm using jpql , want implement simple methode generate last insert id table test. public integer lastinsertid(){ string jpql="select t test t id=:last_insert_id()"; query query=entitymanager.createquery(jpql); return ; } if want last id, given id's generated sequentially, this: em.createquery("select max(t.id) test t", integer.class).getsingleresult();

asp.net mvc - Trying to create drop down login for Orchard CMS -

i new orchard , asp.net mvc. trying override login process users instead of going dedicated login page (the default process) drop down form user menu logs them in. have created overrides in custom theme logon.cshtml , user.cshtml . code follows: //user.cshtml @using system.web.mvc; @using orchard.contentmanagement; <nav class="navbar navbar-default navbar-fixed-top"> <div class="container-fluid"> <ul class="nav navbar-nav pull-right"> @if (workcontext.currentuser != null) { <li class="dropdown"> <button id="userdropdown" class="btn btn-primary navbar-btn dropdown-toggle" data-toggle="dropdown"> welcome @html.itemdisplaytext(workcontext.currentuser) <span class="caret"></span> </button> <ul class="dropdown-menu"> <li...

pointers - The meaning of "asterisk type asterisk" in C : *(volatile int *) foo -

i have tried looking around not able find answer this. found explaining when use double asterisk, **, however, not sure whether applied case. i have come across embedded systems code looks bit foreign me : port0 = *(volatile int *)(0x1c002100) what operation doing reads gpio port address 0x1c002100 . deal asterisks ? i have written : port0 = *0x1c002100 are doing type of pointer type casting , hence use 2 asterisks ? best guess. thank ! look @ expression, first convert integer constant pointer, deference pointer, yield integer. same as: int *p = (volatile int *)(0x1c002100); int n = *p; port0 = n; the first * denotes pointer type, second dereference operator. however second line invalid c code, since cannot dereference integer. port0 = *0x1c002100;

c# - Grouping of WPF-CustomControl, which inherits from RadioButton, just works with GroupName -

i have made in wpf-customcontrollibrary customcontrol, inherits radiobutton. in constructor of customcontrol customradiobutton override dependyproperty ischeckedproperty default value (in case false). /// <summary> /// constructor. /// </summary> static customradiobutton() { defaultstylekeyproperty.overridemetadata(typeof(customradiobutton), new frameworkpropertymetadata(typeof(customradiobutton))); // override default value of base-dependencyproperty. ischeckedproperty.overridemetadata(typeof(customradiobutton), new frameworkpropertymetadata(false)); } as long set in application, use customcontrollibrary, property groupname of radiobuttons, grouping mechanism works. if 1 radiobutton enabled after click, others (which belong same group) disabled. but if don't set property groupname, grouping doesn't work anymore. if click on radiobutton, enabled forever. how can grouping garanteed without explicit setting of property groupname? thank...

spring - Getting a java.lang.NoSuchMethodError when trying to connect to Oracle via Hibernate -

Image
i building application using spring mvc , hibernate. have not integrated hibernate spring yet (new both), , wanted ensure session can opened through hibernate first. i created simple function test , receiving following error : exception in thread "main" java.lang.nosuchmethoderror: org.hibernate.integrator.internal.integratorserviceimpl.(ljava/util/linkedhashset;lorg/hibernate/boot/registry/classloading/spi/classloaderservice;)v my logs tell me error occurs when try use standardserviceregistrybuilder().applysettings() function call. i have placed sample function below tries create connection (please note void, , not within other try catch exceptions) public static void main (string [] args) { testhibernate(); } public static void testhibernate() { try { string hibernatefilepath = "src/main/java/hibernate.cfg.xml"; file hibernatefile = new file(hibernatefilepath); configuration configurati...

How to make generic this function in C++ (i.e., template based) -

i use gcc version 4.6.3. want implement function allocate 2-dimensional matrices , initialize them. used following code, want template based (or generic) one. want generic function handle bool, float, , double @ same time (the procedure similar in cases). please me, or introduce me better way allocate 2d matrix. void doublealloc2d(double ** &t, int r, int c,double initialvalue=0) { t=new double*[r]; if (!t) { if (details) std::printf ("not enough memory.(code: 461546596551)\n"); getchar(); exit(-1); } (int i=0;i<r;i++) { t[i] = new double[c]; if (!t[i]) { if (details) std::printf ("not enough memory.(code: 461651651)\n"); getchar(); exit(-1); } (int j=0;j<c;j++) t[i][j] = initialvalue; } } you don't specify want generic, i'll guess type (and maybe dimensions). usual way create object (inclu...