Posts

Showing posts from February, 2010

c# - How to capture volume control keys in IBM/Lenovo ThinkPad? -

i have ibm thinkpad notebook , pcmcia sound card. volume control works integrated sound card. want fix somehow writing small application. i tried find codes of these keys this: private void form1_keyup(object sender, keyeventargs e) { labelkeycode.text = e.keycode.tostring(); } however not working. im not getting codes. looks these keys not part of "keyboard device". note: code code preview, in application want use winapi global keyboard capture. how can capture these keys? edit: i tried reverse-engineer little, , browsed "hkvolkey.dll" (file ibm hotkey software) dependency walker, found 2 function names there: registervolumehotkey , deregistervolumehotkey. i think approach wrong. have @ this: disable keyboard globally wpf window as input keys might registered, not regular input control keys. maybe of use more direct approach: http://naudio.codeplex.com/ naudio open source .net audio , midi library, containing dozens of u...

linux - Virtual memory sections and memory mapping area -

Image
as process has virtual memory copied ram during run time. given in previous post. which part of process virtual memory layout mmap() uses? i have following doubles : if memory mapping inside unallocated memory , inside process's virtual memory. virtual memory helps avoid 1 process touch other process's virtual memory. how can memory mapping used interprocess communication(ipc)? in os linux, whether has each individual process separate section of heap, stack , memory mapping or processes have 1 common section heap, stack , mmap? example : if there p1,p2 , p3 processes running on linux os. have common table given in picture or each individual task have separate table each section. in 32 bit system, 2^32=4 gigabytes of virtual memory possible , 1g byte reserved kernel , 3 gigabytes userspace applications. can each individual process have 3 gigabytes of virtual memory or sum of userspace applications size 3 gigabytes (i.e virtual memory size of (p1+p2+p3)<=3...

Internationalization of RPM spec -

a single rpm spec file has support multiple locale of linux [en & ja]. suppose checks java existing, if not throws exception, " error: java not installed ". on japanese machine japanese message should shown. in spec file java_err_msg declared macro. want know how localize below ' java_err_msg ' behave summary, group, description, etc. %define java_err_msg " error: java not installed " so, spec file picks corresponding message based on locale of pc. looking solution in summary, group, description case based on system locale rpm display appropriate message. below; summary: appname summary(ja): appname[in japanese] group: xyz group group(ja): xyz group[in japanese] please let me know better solution. i assume testing java existence in rpm %pre script let. if have single message in 2 locales, can test lc_all envvar , hardcode both en , ja messages emitting appropriate. slightly better write program proper locale handling invoked ...

angularjs - ng-include in ui-bootstrap tooltip -

i testing angularjs , ui-bootstrap tooltips : http://angular-ui.github.io/bootstrap/#/tooltip what want achieve tooltip working buttons inside. i have tried : <input type="text" value="{{activity.name}}" tooltip-html-unsafe='<button class="btn btn-primary btn-mini" ng-click="addchild(activity)">+</button> <button class="btn btn-danger btn-mini" ng-click="remove(activity)">x</button> <button class="btn btn-danger btn-mini" ng-click="removechildren(activity)" ng-show="activity.children.length > 0">x children</button>' tooltip-trigger="focus" tooltip-placement="right" /> which ugly , not work. buttons rendered not execute 'ng-click'. is there way can tell tooltip fetch partial , keep ng-click functional ? tooltips contain "live" html (with angularjs directives working etc.) not supporte...

java - Convert String to Date using a specific format -

i have date string: 2013-08-07t11:08:45.000+02:00 i need convert date using simpledateformat have problem format . try : yyyy-mm-dd't'hh:mm:ss.sssz said here : http://developer.android.com/reference/java/text/simpledateformat.html

c - 2 ways of initializing a linked list, do they equal? -

typedef struct node{ int data; struct node* next; }listnode; void init(listnode **head){ (*head) = (listnode *)malloc(sizeof(listnode)); (*head)->next = 0; } listnode* another_init(){ listnode *head = (listnode *)malloc(sizeof(listnode)); return head; } i have problems: 1.in function init,why should put second rank pointer ? 2.is function init same another_init ? another_init not "the same as" init. doesn't set next -pointer 0. malloc(3): malloc() allocates size bytes , returns pointer allocated memory. memory not cleared.

What does the HEAD@{n} mean in the output for git reflog? -

what these head@{0} , head@{1} mean? isn't head supposed tag pointing single commit? why displayed on both then? git reflog 97df263 head@{0}: commit: made first change file. yay! 4333289 head@{1}: clone: https://github.com/tswicegood/mysite head@{1} old head, head@{2} head before that, , on. example: $ git reflog abcdefg head@{0}: initial commit. $ git commit -m "add new function." [master ab123cd] add new function. 1 file changed, 15 insertions(+), 2 deletions(-) $ git reflog ab123cd head@{0}: add new function. abcdefg head@{1}: initial commit.

css - Adding text to a hover over image -

i new css , have been experimenting last few weeks. have created css hover on image button, need add text on top of it. for reason every time try add it, text placed in div box below , doesn't placed in area wish (over top of image) i have added code jsfiddle below, appreciated! http://jsfiddle.net/leeyum8721/lgh4z/ <style> .img3 { width: 313px; height: 177px; } .stjohnspagebutton { width:313px; height:177px; display:block; } #stjohnsbutton { background-image:url('http://www.ovoma.com/wp-content/uploads/2013/08/venues-page_03-2.jpg'); } .stjohnspagebutton:hover { background-position:left 177px; } </style> <div class="img3 left"> <a href="" id="stjohnsbutton" class="stjohnspagebutton"></a> </div> working demo all needed z-index edit 1: updated fiddle. edit 2: go further , make im...

c# - Cannot Split Table with EF 5 - Code First - with existing database -

Image
i trying split legacy user table 2 entities using 1 one mapping keep getting migration errors stating database out of sync, though (i think mapped) , trying make one-to-one relationship. this existing database (although using code first migrations become important down line) have not added changes database (although unsure one-to-one table split expects), keep getting this: the model backing 'context' context has changed since database created. consider using code first migrations update database i can update database (either manually or via migrations) have no idea out of sync no new fields have been added , names match up. baseentity: public abstract class baseentity<t> { [key] public t id { get; set; } public datetime createdon { get; set; } } membership model: public class membership : baseentity<guid> { public string username { get; set; } public bool approved { get; set; } public bool locked { get; set; } publi...

c# - Protect source code of an ASP.NET website -

in our college have competition--students have develop , show code. has cash prize. have done entry website (c#) using asp.net. problem website in computer laboratory of college, can open visual studio , copy project or edit it. i want protect project. there way put password project alone in visual studio? make attractive have hosted website in iis of server, using ip adresss can run project anywhere intranet access. when put lock easyfilelocker, unable open , run project using ip address. i want run project anywhere in intranet, protect code. how can that? presuming source code somewhere safe (if not, put somewhere safe on have control), deployed end result need not expose source code in raw format; can pre-compile asp.net websites entirely (such markup can't edited on server - @ least not easily) - selecting pre-compilation options on deploy screen, being sure uncheck "allow website updatable". the exact method of specifying right build opti...

asp.net mvc 4 - Session Cookies on IIS Web Farms -

i using jquery plug-in create cookie ( https://github.com/carhartl/jquery-cookie ) , have been allowing cookie default "session cookie". behavior have. concern when deploy web site production, in web farm on environment. can me understand kind of issues, if any, run session cookies on web farm? version of iis on web farm iis 7.5. no issues @ all. cookies stored on client. don't know or care server side infrastructure , how many nodes have. there 2 types of cookies: session cookies - live in memory of webbrowser , not survive browser restart. persistent cookies - stored files on file system specified duration , survive browser restarts. from perspective of server makes strictly no difference. cookie sent client on each request , node serving request receive cookie. if on other hand storing information in memory of web server, such example using asp.net session default inproc state have problems. has nothing client side cookies.

android - Datepicker dialog call two times -

in application have used 1 datepicker dialog.which show date picker popup fine , selcted item displayed correctly.my problem in call event print date 2 times added in db 2 times when insert date.please 1 me please 1 me... datepickerdialog: new datepickerdialog(getactivity(),r.style.theme_customdialog,changedate,calendarfuture.get(calendar.year) ,calendarfuture.get(calendar.month),calendarfuture.get(calendar.day_of_month) ).show(); call event is: datepickerdialog.ondatesetlistener changedate=new datepickerdialog.ondatesetlistener() { @override public void ondateset(datepicker view, int year, int monthofyear, int dayofmonth) { calendarfuture.set(calendar.year, year); calendarfuture.set(calendar.month, monthofyear); calendarfuture.set(calendar.day_of_month, dayofmonth); log.i(tag,"futurecalendar:...

ios - Can Weborb be used to do live video streaming from an iPhone through a media server? -

i new multimedia , ios programming , came across weborb while googling, provides rtmp library ios. doesn't mention if can used stream live video through media server red5. if 1 have used this, please let me know whether can used stream live video iphone media server , fit in whole setup. act server between media server , iphone application or have own media server? i want links tutorials can me start real coding pertaining rtmp streaming media server? thanks. the short answer yes, rtmp library ios can used red5, fms, weborb etc. library not server itself, yet client. establish rtmp connection server , encodes stream before send server. as remember library distributive contains example demonstrate how streaming works. unfortunately, official site doesn't show examples related streaming, available examples can useful start work library ( http://www.themidnightcoders.com/products/weborb-for-mobile/ios-integration/rtmp-ios-examples-integration-between-java-net...

c# - How to set first index as blank in combobox -

i have combobox bound datasource.in combobox have add blank field @ index 0. i have written following code getting records. public list<tbasubtype> getsubtype(int typ) { using (var tr = session.begintransaction()) { try { list<tbasubtype> lstsubtypes = (from sbt in session.query<tbasubtype>() sbt.ftype == typ select sbt).tolist(); tr.commit(); return lstsubtypes; } catch (exception ex) { cusexception cex = new cusexception(ex); cex.write(); return null; } } } after bind combobox data binding source below code. m3.cm.bal.cm cmobj = new m3.cm.bal.cm(wsession.createsession()); ...

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 = "...