Posts

Showing posts from February, 2010

interpolation - Interpolating 1 dimensional array using OpenCV -

Image
i define array of 2 values, , try use imgproc module's resize function resize 10 elements linear interpolation interpolation method. cv::mat input = cv::mat(1, 2, cv_32f); input.at<float>(0, 0) = 0.f; input.at<float>(0, 1) = 1.f; cv::mat output = cv::mat(1, 11, cv_32f); cv::resize(input, output, output.size(), 0, 0, cv::inter_linear); for(int i=0; i<11; ++i) { std::cout<< output.at<float>(0, i) << " "; } the output have expected is: 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 what is: 0 0 0 0.136364 0.318182 0.5 0.681818 0.863636 1 1 1 clearly, understanding of how resize works wrong @ fundamental level. can please tell me doing wrong? admittedly, opencv overkill such simple linear interpolation, please me wrong here. it's simple. opencv image processing library. should remember working on images. take @ output when have 8 pixels in destination image 0 0 0.125 0.375 0.625 0.875 1 1 if take @ image it&

excel - Continuing a function -

i'm trying write vba macro analyzes multiple sheets of data in same excel file. have set when it's analyzing various sheets, when finds error, stops program completely. have figured out how go next sheet cannot program continue running. here have far: `if counter > 480 worksheets(activesheet.index + 1).select end end if` i know end function ends running program when take out not work, how can program continue running before reaches sheet error? put loop want end in separate function or sub, when error found, use exit function or exit sub if it's sub. simple example using code: sub main othersub 'continue here end sub sub othersub if counter > 480 worksheets(activesheet.index + 1).select exit sub end if end sub

bash - linux script with netcat stops working after x hours -

i've have scripts: #!/bin/bash netcat -lk -p 12345 | while read line match=$(echo $line | grep -c 'keep-alive') if [ $match -eq 1 ]; [start command] fi done and #!/bin/bash netcat -lk -p 12346 | while read line match=$(echo $line | grep -c 'keep-alive') if [ $match -eq 1 ]; [start command] fi done i've put 2 scripts in '/etc/init.d/' when restart linux machine (rasbpi), both scripts work fine. i've tried them 20 times, , keep working fine. but after around 12 hours, whole system stops working. i've put in loggin, seems scripts not reacting anymore. when i; ps aux i can see scripts still running: root 1686 0.0 0.2 2740 1184 ? s aug12 0:00 /bin/bash /etc/init.d/script1.sh start root 1689 0.0 0.1 2268 512 ? s aug12 0:00 netcat -lk 12345 root 1690 0.0 0.1 2744 784 ? s aug12 0:00 /bin/bash /etc/init.d/script1.sh start r

opencl optimal group size -

i'm running mandelbrot generator (2d image static params) on opencl. program straightforward: __kernel void mandelbrot(__global uchar * output, const float xstep, const float xoffset, const float ystep, const float yoffset, const int maxiter) { int gid_y = get_global_id(1); int gid_x = get_global_id(0); //calculate x , y on fly every pixel. //this fast reading precalculated rulers global memory. float x = gid_x * xstep + xoffset; float y = gid_y * ystep + yoffset; float real = 0; float imag = 0; int out = 0; for(int curiter = 0; curiter < maxiter; curiter++) { float nreal = real*real - imag*imag + x; imag = 2* real*imag + y; real = nreal; if (real*real + imag*imag > 4.0f) { out = curiter; break; } } //normalize output out *= 256.0 / (float)maxiter; output[gid_y * ge

Append lines of text above or below the dataframe in r -

i have huge data frame (dimension:600000 x 6). 6 columns integer values representing different features each row. add 3 lines of text either above or below data frame common rows. possible insert lines of text below or above data frame? for example: given dataframe, name<-letters[1:10] length<-c(140,50,25,120,156,146,180,98,120,110) quality<-c(20,25,35,20,15,28,32,35,29,25) df<-data.frame(name,length,quality) how insert 3 lines of text either above or below data frame,df: no. of reads = 10 %at=32 %gc=30 the output should like: name length quality 1 140 20 2 b 50 25 3 c 25 35 4 d 120 20 5 e 156 15 6 f 146 28 7 g 180 32 8 h 98 35 9 120 29 10 j 110 25 no. of reads = 10 %at=32 %gc=30 are looking this? prettyprint <- function() { print(df) cat("no.

java - Would inner classes work better for what I'm modelling? -

i'm bulding application in java play 2. modelling different classes of people, each different relationships other classes related application process. each application has signatory , certificateholder , , enrolmentofficer . i realised since 1 person or of things, redundant store information on them 3 times. refactoring in order! i decided have single person class store 1 of each of signatory , certificateholder , , enrolmentofficer classes via object composition. access of properties using person.signatory. notation. what i'm wondering this: since 3 specialised classes not exist outside of person , better achieve goal using inner classes? mean so: public class person { public class signatory { // signatory fields go here } public class certificateholder { // certificateholder fields go here } public class enrolmentofficer { // enrolmentofficer fields go here } // more general person code goes here } it s

android - Google Maps API v2 displaying maps only on one device -

we using same api key in manifest file, obtained the sha-1 fingerprint displaying map on 1 device(the first device run it) , not on other devices. using fragmentactivity. problem. please guys change max sdk ver 18 (android 4.3). suppose device fail. an other option - if use developers sha-1 (the 1 generate adb) , instaled app on devices difrent computers computer, assume need sha-1 fingerprint other computer.

build.gradle - Gradle: Show dependencies that have newer versions -

is there plugin or sth. else gradle informs when there new library versions available depedency? might difficult if libs not stick well-known version conventions others think should possible find out!? if there not, hints how implement feature appreciated. thanks no such plugin ships gradle. there might third-party plugin, i'm not aware of one. implement this, iterate on configuration's resolved dependencies (using configuration.resolvedconfiguration or configuration.incoming api) , query website (e.g. http://search.maven.org ) or web service latest versions. api details, see gradle build language reference .

html - How can i parse this xml in javascript? -

i need parse in javascript xml received rest webservice, format below, , put information in grid show on web page. few examples, but, format of xml not typical... can me please? need point start.... many thanks! <root tablename="center"> <row> <row_attribute name="cod">1100</row_attribute> <row_attribute name="nom">name1</row_attribute> <row_attribute name="cod2">tgn</row_attribute> </row> <row> <row_attribute name="cod">1200</row_attribute> <row_attribute name="nom">name2</row_attribute> <row_attribute name="cod2">tgt</row_attribute> </row> </root> you can use jquery.parsexml this. uses underlying browser xml parser , gives object can searched using jquery methods.

ActiveMQ - memory not released after consuming all messages -

i've made test, based on example solution of activemq-cpp library. in test send 50,000 messages queue, , after they're sent consume them, individual_acknowledge on session , message->acknowledge() on every consumed message. consumer asynchronous. memory (private working set) of java.exe before sending messages: 209,320 kb. after sending messages: 412,548 kb. after consuming messages: 434,637 kb. meaning, although queue size 0, memory not released. missing? thanks. besides jvm processing mentioned above there number of other factors in play here. depending on state of broker when started producer sending messages there number of resources allocated on broker create queue , various other management objects remain in memory facilitate message routing etc. analyze memory usage , check leaks should use tool yourkit etc.

html - Bootstrap Progress bar doesn't work with Panel Inside -

i trying add panel inside progress bar when add panel progress bar not work/increase width. http://getbootstrap.com/components/#progress http://getbootstrap.com/components/#panels here tried: http://jsfiddle.net/fs2zq/ <div class="progress progress-striped active" style="height:100px;border-style:solid;"> <div class="panel panel-primary" style="width:15%;height:100px;"> <div class="panel-heading"> <h3 class="panel-title" style="text-align:center;">division 10</h3> </div> <strong><div align="center">0 pts</div></strong> </div> <div class="progress-bar progress-bar-danger" style="width: 50%"></div> </div> maybe wont somethig http://jsfiddle.net/fs2zq/1/ <div class="panel panel-primary" style="width:15%;height:100px;fl

integer - System Overflow Int16 Error in C# on German PCs -

i having bit of issue here. have snippet below of application has been working fine on pc's throughout world of usa, uk, south africa, , australia. however, on 2 german colleagues machines, following code fails error of: system.overflowexception: value either large or small int16. this happening @ convert.toint16 steps. wondering if can caused decimal system in germany being comma's opposed periods? also, fielditemsvalues value example is: [inputtext_confirmname,0,2,49.5216,726.6744,303.2712,47.9664,false,0,0,false,0] all strings string[] widgetproperties = fielditemvalues[0].split('_'); string widgettype = widgetproperties[0]; string widgetid = widgetproperties[1]; console.writeline("type: " + widgettype + " id: " + widgetid); float widgetleft = convert.tosingle(fielditemvalues[3]); float widgettop = convert.tosingle(fielditemvalues[4]); float widgetwidth = convert.tosingle(fielditemvalues[5]); float widgetheight = convert.tos

pip - Cannot install netCDF4 python package on OS X -

i'm trying install netcdf4 on os x pip install netcdf4 , getting following error: ------------------------------------------------------------ /usr/local/bin/pip run on wed aug 7 23:02:37 2013 downloading/unpacking netcdf4 running setup.py egg_info package netcdf4 hdf5_dir environment variable not set, checking standard locations .. checking /users/mc ... checking /usr/local ... checking /sw ... checking /opt ... checking /opt/local ... checking /usr ... traceback (most recent call last): file "<string>", line 16, in <module> file "/var/folders/jj/0w0dd3n16jq4g5579g6c7h040000gn/t/pip-build/netcdf4/setup.py", line 114, in <module> raise valueerror('did not find hdf5 headers') valueerror: did not find hdf5 headers complete output command python setup.py egg_info: hdf5_dir environment variable not set, checking standard locations .. checking /users/mc

CORS issue with Rails 3 consuming mongodb rest api -

i'm experiencing cross-origin resource sharing (cors) issue rails 3 application consuming mongodb simple rest api. have coffeescript/javascript trying consume mongodb simple rest api , chrome prevents following console message: xmlhttprequest cannot load http://127.0.0.1:28017/my-db/my-collection/. origin http://127.0.0.1:3000 not allowed access-control-allow-origin. i've added 2 controller methods blog post : before_filter :cors_preflight_check after_filter :cors_set_access_control_headers def cors_set_access_control_headers headers['access-control-allow-origin'] = '*' headers['access-control-allow-methods'] = 'post, get, options' headers['access-control-max-age'] = '1728000' end def cors_preflight_check if request.method == :options headers['access-control-allow-origin'] = '*' headers['access-control-allow-methods'] = 'post, get, options' headers['acc

java - JDBC generated key from insert on duplicate -

if have insert on duplicate key clause, , there duplicate key, there way primary key duplicated? or have own manual query? far can tell getgeneratedkeys() callablestatement class not return new insert wasn't done. edit sorry if wasn't clear want primary key of record back. so if have following table (excuse syntax, typing freehand): create table some_table( id int(11) unsigned not null auto_increment, value varchar(500)not null, count int(10) unsigned not null default '0', primary key (id), unique key (value) ); insert some_table(value) on duplicate key update count = count + 1; if add 'test' value, new record added , id returned getgeneratedkeys(); if attempt add 'test' again, key exists , therefore count updated. want primary key/id of row updated. have see no results getgeneratedkeys() - none generated - , select after fact? on duplicate key update count = count + 1, id = last_insert_id(id) note: shouldn't neces

sql - Syntax Error Insert Into statement java -

i want add dataset ms acces database. syntax error in sql statements @ executeupdate statement. if me, great. here can see error: java.sql.sqlexception: [microsoft][odbc-treiber für microsoft access] syntaxfehler in der insert into-anweisung. @ sun.jdbc.odbc.jdbcodbc.createsqlexception(unknown source) @ sun.jdbc.odbc.jdbcodbc.standarderror(unknown source) @ sun.jdbc.odbc.jdbcodbc.sqlexecute(unknown source) @ sun.jdbc.odbc.jdbcodbcpreparedstatement.execute(unknown source) @ sun.jdbc.odbc.jdbcodbcpreparedstatement.executeupdate(unknown source) @ verwaltung.listenerregistrieren.addbenutzer(listenerregistrieren.java:47) @ verwaltung.listenerregistrieren.actionperformed(listenerregistrieren.java:28) @ javax.swing.abstractbutton.fireactionperformed(unknown source) @ javax.swing.abstractbutton$handler.actionperformed(unknown source) @ javax.swing.defaultbuttonmodel.fireactionperformed(unknown source) @ javax.swing.defaultbuttonmodel.setpressed(unknown source) @ javax.swing.plaf.basic.

Importing a data frame vs creating one in R -

i trying create specialized summary 'matrix' supervisor, , r export in clean, readable form. such, creating scratch basically, tailor our project. problem can't figure out how created data frame behave imported one, headers. i comfortable dealing imported data frames headers, , calling specific rows name instead of column number: iris$sepal.length with(iris,sepal.length) iris['sepal.length'] now, if want create data frame (or matrix, i'm not entirely sure difference is), have tried following: groups<-c("group 1", "group 2") factors<-c("fac 1", "fac 2", "fac 3","fac 4", "fac 5") x<-1:10 y<-11:20 z<-21-30 data<-cbind(groups, factors, x, y, z) names(data) #returns null data$x #clearly doesn't return column 'x' since matrix 'data' has no names data<-data.frame(cbind(groups, factors, x, y, z)) names(data) #confirms there header names so, hav

angularjs - Show Bootstrap tooltip on focus when an angular input has an error -

this example taken angularjs's docs <form name="myform" ng-controller="ctrl"> usertype: <input name="input" ng-model="usertype" required> <span class="error" ng-show="myform.input.$error.required">required!</span> </form> i want achieve same behavior bootstrap tooltip. i've looked @ angular ui-bootstraped project ( http://angular-ui.github.io/bootstrap/ ) can't figure out how this. something like: <input type="text" value="click me!" tooltip="see? click away..." tooltip-trigger="focus" tooltip-placement="right" tooltip-enabled="myform.input.$error.required" <--- pseudo code /> i've tried several ways, looks can modify source code angular-bootstrap proper solution. but. there 'hacky' solution, maybe it'll or that's needed(examples angular-bootstrap , a

wpf - Is it possible to access file in xap in desktop application -

is possible access or file list in xap file through desktop application.if possible please let me know how this. thanks dinesh xaps are zip files . you can use zip library, such ziparchive class in .net 4.5.

sqlite - SQL syntax: select only if more than X results -

i have table measurements called measures . table has 1 column location , second colum corresponding value (example simplified). the table looks (note 2 entries loc1 ): location | value ----------------- loc1 | value1 loc1 | value2 loc2 | value3 loc3 | value4 loc4 | value5 i want formulate sql query (actually use sqlite) returns first 2 rows of table (i.e. loc+value1 , loc1+value2), because location has more 1 entry in table. the pseudotext formulation be: show me rows of locations, present more once in whole table pseudcode: select * measures count(location on whole table) > 1 the solution may simple, somehow seem not crack nut. what have far select statement, returns locations have more 1 entry. next step need rows correspond locations returned query: select location measures group location having count(*) > 1 so next step tried join same table , incorporate above query, results incorrect. tried this, wrong: select t1.location, t1.

c# - Datatable is not being populated -

attempting populate datatable sqldatareader (i don't think can use dataadapter because of way parsing xml string). looking @ examples of datatables online should work, doesn't. when debug table {} when runs through while loop. what's deal? string sqlentry = configurationmanager.connectionstrings["sqlpass"].connectionstring; sqlconnection conn = new sqlconnection(sqlentry); try { conn.open(); conn.changedatabase(configurationmanager.connectionstrings["db"].connectionstring); string sqlquery = "select * equipinspection"; sqlcommand sqlcomm = new sqlcommand(sqlquery, conn); sqldatareader myreader; myreader = sqlcomm.executereader(); datatable table = new datatable(); table.columns.add("equipment", typeof(string)); table.columns.add("serialno",typeof(string)); table.columns.add("contractor",typeof(string)); table.columns.add("date", typeof(string)); t

php - How to create custom post types with categories in wordpress with its category? -

how create custom post types in wordpress category i want create news section in site (same posts), want create own news section having post type news. please make suggestion. try : <?php add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'news', array( 'labels' => array( 'name' => __( 'news' ), 'singular_name' => __( 'news' ) ), 'capability_type' => 'post', 'public' => true, 'supports' => array( 'title', 'editor', 'excerpt', 'trackbacks', 'custom-fields', 'revisions', 'thumbnail', 'author', 'page-attributes', ) ) ); } register_taxonomy( 'news_category', 'news',array('label' => __( 'categories&

jQuery AJAX call ignoring underscores in place of spaces -

i have code extracts value dropdown menu , uses value parameter in ajax call. the code looks this: html <select class='formdropdown ' id='ass-assessmentreason' name='ass-assessmentreason'> <option value='emergency'>emergency</option> <option value='follow-up'>follow-up</option> <option value='nurse call'>nurse call</option> </select> js $('#ass-assessmentreason').change(function() { var selectedoption = $(this).find(":selected").text().replace(/ /g,"_"); // replace whitespace _ url transportation console.debug(selectedoption); $.ajax({ type: "post", url: "otrfollowup.php", data: "followup=" + selectedoption, i've cut off rest of code works absolutely fine when selected dropdown option has no spaces, truncates value space in it. as can see attempted remedy temporar

java - JFace and FieldEditor -

from eclipse rcp, i'm building preference page using field editors ( http://www.eclipse.org/articles/article-field-editors/field_editors.html ) i'm trying use field editor booleanfieldeditor, subclass of fieldeditor. my issue in javadoc, don't find function change state (checked/unchecked) of field editor. where setchecked(boolean) function? :-) missed something? you accessing preference store's apis. getpreferencestore().setvalue(preferenceid, value); where preferenceid name of boolean preference (i.e. new booleanfieldeditor(preferenceid, label, parent); ), , value true/false . you current value id getpreferencestore().getboolean(preferenceid);

php - Creating where function with dates in sql query (Laravel 4) -

i have php function retrieving list of records based on 'created_at' column. public function browseresults($days = 90) { $search_period_in_seconds = 60*60*24*$days; $today = time(); $reference_date = $today - $search_period_in_seconds; $query ="select * brands"; $query .=" created_at > ".$reference_date; $results = db::select($query); // laravel syntax performing query. this isnt returning required results. think issue because mysql database storing dates in following format: 2013-08-04 15:54:42 compared unix timestamp. have tried inserting form of strtotime() function sql caused error. there anyway of avoiding having pull of records database , doing comparison in php? i.e. possible perform filter in sql query? many thanks you check out mysql function from_unixtime: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_from-unixtime or create correct date php: $datetime = new datetime("-" . $d

mysql - storing allowed settings combinations -

i making interface user can define settings. settings separated in categories , user can select 1 parameter each category. thing is, combinations of parameters allowed , must prevent users selecting incompatible parameters. i trying design mysql database structure did not find solution satisfies me. what thought of : categories - id - description parameters - id - parent category id - description combinations -id - string concatenation of parameters ids ordered category eg. : 102596 combination of parameters 10 category 1, 25 category 2, , 96 category 3. the problems : if 1 day need more hundred parameters ? ok have these tables: categories - id - description and each category has multiple parameters: parameters - id - parent category id - description now want store parameters user has selected. why dont handle operation of permitting of selecting 1 parameter per category outside of database design scope? if can that, combination table sim

html - Setting a text right to a pic which both link to a same page in the middle of the pic -

Image
in mobile theme of site there shall picture text right both link parent menu. however, can't adjust text height (it should in center of picture height text appears @ bottom of picture, see pictures: (left current, right should be) my current files: in html: <div id="topbar"> //<div id="title">Ãœber</div> //<div id="bluerightbutton"><a href="/m/language.html">more</a></div> <div id="leftnav"><a href="/m/de/futuristic-os">futuristicos</a></div> </div> and css: #leftnav a:before{content:url("../images/leftback.png");} #leftnav a:first-child{z-index:2; padding-bottom: 50%; width:auto} #leftnav a{z-index:3;margin-left:-4px;border-width:0 5px 0 13px;padding-right:4px;float:left} in css, set line-height of text value of height image. should vertically center on image. see fiddle: http://jsfiddle.net/gyatesiii/cld4t/1/

email - Outgoing mails to spam directory -

i've vps. installed postfix , necessary mail server. (i've used guide: https://www.digitalocean.com/community/articles/how-to-install-postfix-on-centos-6 ) then, configured dns recomended. (this configure http://t1308.hizliresim.com/1d/7/r834r.png ) but there's still problem that: mails going spam directory? why? should do? i've checked banlists , there's no problem black lists. any idea? how can solve problem? to see if mail server has glaring problem cause other mail servers think it's spammer, try sending message mail server check-auth@verifier.port25.com . service bunch of checks, , you'll report ton of information, such whether or not mail server's dns setup correctly, whether mail server's ip on black lists, if have problem spf records, etc.

php - Remove last slash in URL, only if no directory is present -

i trying remove last / url, if there no directory present. there way check if(3 slashes && not https) remove slash ? or there better way accomplish trying do? what have far $url = preg_replace(array('{http://}', '{/$}'), '', $project->url); current outputs: http://www.example.org/ => www.example.org https://www.example.org/ => https://www.example.org http://www.example.org/dir/ => www.example.org/dir https://www.example.org/dir/ => https://www.example.org/dir http://www.example.org/dir/dir/ => www.example.org/dir/dir https://www.example.org/dir/dir/ => https://www.example.org/dir/dir what want get http://www.example.org/ => www.example.org https://www.example.org/ => https://www.example.org http://www.example.org/dir/ => www.example.org/dir/ https://www.example.org/dir/ => https://www.example.org/dir/ http://www.example.org/dir/dir/ => www.example.o

ios - Why does adding imageview to navigation bar in storyboard remove navbar? -

Image
i have working app tabbarcontroller based app. first viewcontroller uitableviewcontroller. 3 tabs have navigation bar on top, added object library. app looks like: then wanted set image on navbar centered logo. looked around , found code looks this: uiimage *image = [uiimage imagenamed:@"icon57.png"]; uiimageview *imageview = [[uiimageview alloc] initwithimage: image]; self.navigationitem.titleview = imageview; or [self.navigationcontroller.navigationbar setbackgroundimage:[uiimage imagenamed:@"icon57.png"] forbarmetrics:uibarmetricsdefault]; but didnt work. got empty white nav bar. decided add uiimageview navbar dragging in object library reason makes navbar disappear , end this: why happen? the way doing not supported in interface builder. encourage file radar support doing that. can accomplish via 2 different ways, 1 in code, other in ib. through interface builder you can drag uiview instance object library , drop cen

csv - Java-errors and inability to locate the answer -

i writing program needs read csv-file. , print out first word on each line ,plus first following number right after it. strangely enough ,my code can work on friends computer not own. editing nomenclature methods , variabeles english (so easier guys read) has yielded more peculiar errors ,which netbeans cant me locate. short example of how should when works : binnenstad 17.460 bloemekenswijk 8.848 brugse poort - rooigem 17.652 ... the main class code : package autobezit; import java.io.file; import java.io.filenotfoundexception; import java.util.scanner; public class autobezit { /** * @param args command line arguments * @throws java.io.filenotfoundexception */ public static void main(string[] args) throws filenotfoundexception { hood brugge = new hood("brugge", 50000); system.out.println(brugge.getinfo()); autobezit situation = new autobezit(); situation.initialise(); } public void initialise() thr

mysql - PHP Mysqli 'dynamically' saying what connection (variable) should be used -

what best way use multiple (dynamic) php mysqli connections? currently have single mysql server. data on server in few databases. in not distant future storage needs larger server can handle. have place databases on 1 server , on another. , in further future more servers come play. in effort of 'future proving' scripts thought class point right server might best solution. send 'key' of data want , says connection should using because stored on server. instance if want logs send key 'logs' , class says need use predefined connection 'connection_a'. the class looks like: class databaseconnection { public $connection_name; function __construct($key){ if($key=='logs'){ $connection_name = 'connection_a'; } elseif($key=='userdetails'){ $connection_name = 'connection_b'; } } } so is: $connection_a = new mysqli($dbhosta, $dbusera, $dbpassa, $dbnam

php - validating a drop down list using javascript -

<?php session_start(); if (isset($_session['login']) && $_session['login'] = '1') { //========================================================= //the following page used create dynamic survey. //========================================================= $qnum = 'q1'; $question = 'question not set'; $answera = 'unchecked'; $answerb = 'unchecked'; $answerc = 'unchecked'; $qid = array(); $question = array(); $a = array(); $b = array(); $c = array(); $d = array(); $e = array(); $questype = array(); $survey_answers1 = ''; $nominatefriend = ''; //============================================ // open connection database //============================================ $user_name = "root"; $password = ""

asp.net mvc - What must I do to redirect to a Web Form from an MVC controller? -

i have line in controller: response.redirect("~/webforms/reportviewer.aspx"); then simple test code in page_load of "reportviewer.aspx": protected void page_load(object sender, eventargs e) { response.write("hello"); return; } this code not execute, i.e. page_load not execute. suppose there i'm supposed before redirecting web form, have no idea is. have seen ample sample code plainly calls redirect . my web form have crystal reports viewer on it, may have situation: <body> <form id="form" runat="server"> <cr:crystalreportviewer id="crystalviewer" runat="server" autodatabind="true" /> </form> </body> return redirect("~/webform.aspx"); is perfect , return type redirectresult , works awesome, have tested it. my action this public actionresult print() { return redirect("~/webform2.aspx"

CodeIgniter: Trouble removing "index.php" from URL -

i have been trying fix days , have tried following tutorials: this on stackoverflow this ci forums and many many others. none have worked. here problem: whenever click site link in wamp localhost/ci/index.php/homecontroller works fine. if omit “index.php” url (localhost/ci/homecontroller), however, shows me same folder list on localhost. this htaccess file in root: <ifmodule mod_rewrite.c> rewriteengine on rewritebase /ci/ #removes access system folder users. #additionally allow create system.php controller, #previously not have been possible. #'system' can replaced if have renamed system folder. rewritecond %{request_uri} ^system.* rewriterule ^(.*)$ /index.php?/$1 [l] #when application folder isn't in system folder #this snippet prevents user access application folder #submitted by: fabdrol #rename 'application' applications folder name. rewritecond %{request_uri} ^application.* rewriterule ^(.*)$ /index.php?/$1 [l] #checks see if

android - GooglePlay Game Service onLeaderboardScoresLoaded always has empty ScoreBuffer -

i using googleplay game service adding leaderboard in game (actually, several leaderboards). signing in googleplaygameservices works, submitting score given leaderboard-id. checked using onscoresubmittedlistener. result ok, score there. when trying retrieve top scores given id using 'loadtopscores', onleaderboardscoresloadedlistener gets called status_ok, 1 entry in leaderboardbuffer (i checked entry, exact same leaderboard-id submitted score to) , alway 0 entries in leaderboardscorebuffer. not find solution problem. 1 thing seems odd in leaderboardbuffer entry, player rank set -1. couldn't find out means. thanks in advance insights on problem =) i managed find problem myself =) rather easy. since services utilize one's google+ account, have set permissions properly. under "settings" -> "accounts" -> "google" -> "google+" -> "apps google sign-in" entry game. there had allow uploading of score

Is there a way to see which items are not categorized in magento? -

is there way see items not categorized in magneto on backend? know can pull report wondering if there easier? you can use free enhanced admin grids extension, github version allows add categories column on products grid, optionally possible filter on products not assigned category.

ftpwebrequest - How to Download Numerous Files from FTP using C#? -

i need run console application @ scheduled intervals needs download .pgp files ftp site. pgp file in ftp must downloaded. i've found sample code directory listing of ftp , have written here: ftpwebrequest req = (ftpwebrequest)webrequest.create("ftp://ourftpserver"); req.method = webrequestmethods.ftp.listdirectorydetails; req.credentials = new networkcredential("user", "pass"); ftpwebresponse response = (ftpwebresponse)req.getresponse(); stream responsestream = response.getresponsestream(); streamreader reader = new streamreader(responsestream); console.writeline(reader.readtoend()); console.writeline("directory list complete, status {0}", response.statusdescription); reader.close(); response.close(); what must download files of type .pgp directory listing , save them in local directory on our server? the ftpwebrequest , ftpwebresponse objects de

virtualenv path not changed in Python -

i'm trying use python virtualenv , not sure how change path file, this did, created virtualenv execute path\to\env\scripts\activate within environment now, i'm trying check path variable nothing has changed, still pointing same old environment is understanding correct path changed 2) command. regarding point: execute path\to\env\scripts\activate within environment did executing following: source path\to\env\scripts\activate ? doing should change path , prompt temporarily (until execute deactivate ).

c# - Get Local TimeZoneInfo -

i using c#. need local time zone info person running web application. i wondering if timezoneinfo tzinfo = timezoneinfo.local; timezoneinfo.converttimefromutc(result.duedate.value, tzinfo); is use. again depending on time zone person running application is, reflected. yes right, should use. alternative can be timezone localzone = timezone.currenttimezone; but currenttimezone property corresponds timezoneinfo.local property no difference really. it displays names standard time , daylight saving time local time zone.

apache - URL inside php get variable is not redirecting. It gives 404 error -

recently moved hosting godaddy hostgator. i have download page in website (getintopc.com) called download_direct.php accepts url parameters e.g. http://getintopc.com/download_direct.php?c=http://trial.autodesk.com/swdldnet3/2014/amech_pp/dlm/autocad_mechanical_2014_english_win_64bit_dlm.sfx.exe so inside download_direct.php had simple code http meta redirect url in php variable "c" but code not working on new hosting package. gives 404 error. page exists. can verified typing getintopc.com/download_direct.php but seems argument passed in variable not being accepted per code logic. code not changed. working on godaddy.com please me i think need encode redirect url: $c = urlencode("http://trial.autodesk.com/swdldnet3/2014/amech_pp/dlm/autocad_mechanical_2014_english_win_64bit_dlm.sfx.exe"); $url = "http://getintopc.com/download_direct.php?c={$c}"; if value of c not encoded, whole url becomes invalid. hope helps.

c# - Check the eventhandler exist for particular event present in the object -

i have use following code snippet in loop datatable childtable = datatable.dataset.relations[relationname].childtable; if (childtable != null) { ibindinglist = childtable.asdataview() ibindinglist; ibindinglist.listchanged += new listchangedeventhandler(griddatarecord_listchanged); } in case need check listchanged event invoked ibindinglist object.can please , provide suggestion achieve this. in advcance. regards, rajasekar there no way see if handler has been added. luckily, not need to. ibindinglist.listchanged -= griddatarecord_listchanged; ibindinglist.listchanged += griddatarecord_listchanged; assuming well-behaved class (and in case, should able trust class well-behaved), can safely remove griddatarecord_listchanged if has not been added. removing nothing. if ever add handler after removing it, never added multiple times.

how to get website content with xpath? -

i want check if website uses schema.org tags. script empty result. $surl = 'http://adresse.gelbeseiten.de/120002540061/alois-dallmayr-kg/muenchen/altstadt#gaststaetten-und-restaurants;originindex=1;origin=/restaurant/muenchen'; $dom = new domdocument(); @$dom->loadhtmlfile($surl); $xpath = new domxpath($dom); $alinks = array(); $vres = $xpath->query('//text()[contains(.,"itemprop="streetadress")]'); foreach ($vres $obj) { $alinks[] = $obj->textcontent; } print_r($alinks); not sure want exactly. if going <span id="inserat_addr_str" itemprop="street-address"> dienerstr. 14-15</span> using itemprop attribute, try use following xpath (id , text element, assume want use itemprop ) $vres = $xpath->query("//*[@itemprop='street-address']"); // $vres = $xpath->query("//*[@id='inserat_addr_str']"); // $vres = $xpath->query("//*[contains(text(), 

ruby on rails - How can you parse just the first line of a CSV file? -

how can parse first line of csv file? want make sure of appropriate columns provided in file, don't want process whole file. a better way of doing use built-in enumerable support in ruby's standard library csv parser : headers = csv.open('file.csv', 'r') { |csv| csv.first } the block result in file automatically being closed , call return array of parsed headers.

list - Files in python are empty for no reason -

i have tried split world generation actual game, since fail it. reason keeps insisting file empty/ variable gained empty, , sometimes, when afterwards, actual program file has emptied text file info, not. here code: dropbox main code dropbox world gen here's small extract of file handling in main code: world_file = open("c:\users\ben\documents\python files\platformergame files\world.txt", "r") world_file_contents = world_file.read() world_file.close() world_file_contents = world_file_contents.split("\n") world = [] data in world_file_contents: usable_data = data.split(":") world.append(tile(usable_data[0],usable_data[1])) and tile class: class tile(): def __init__(self,location,surface): self.location = location self.surface = surface and error: traceback (most recent call last): file "c:\users\ben\documents\python files\platformergame", line 89, in <module> game.__main__()

ios - Decode base64 converted image on server show corrupt image -

i'm converting image gallery base64, upload 'webservices.asmx'. image corrupt on server, or fault? don't know. tried put string in: ' http://www.freeformatter.com/base64-encoder.html ' , decode string , correct image. my code: // http post nsurl *url = [nsurl urlwithstring:@""]; afhttpclient *httpclient = [[afhttpclient alloc] initwithbaseurl:url]; [httpclient setdefaultheader:@"content-type" value:@"application/x-www-form-urlencoded"]; nsdictionary *params = [nsdictionary dictionarywithobjectsandkeys: [nsstring stringwithformat:@"%d", userid], @"userid", self.imagebase64, @"file", nil]; [httpclient postpath:@"http://www....../webservices.asmx/saveimageios" parameters:params success:^(afhttprequestoperation *operation, id responseobject) {