Posts

Showing posts from March, 2013

php - Select data from SQL database and display in table does not work -

Image
i don't understand why isn't working, have been stuck on ages , tried lots of different alternatives, doesn't print data database. at moment trying id print, want print of data in database (not including hash). here code: <!doctype html> <html> <head> <title>staroids leaderboard</title> </head> <body> <table border=1px> <thead> <tr> <td>name</td> <td>score</td> </tr> </thead> <tbody> <?php $connect = mysql_connect("localhost","root", "password"); if (!$connect) { die(mysql_error()); } mysql_select_db("staroids"); $results = mysql_query("select id scores"); while($row = mysql_fetch_array($results)) { $nam...

shell - Executables deployment in multiple servers regularly -

if there code base , many servers, how should deploy executable in multiple servers regularly? need script this there many system management tools. chef use, great there bit of learning curve. may want os's default package manager , distribute packages of code base.

Android ListView summary -

i'm using listactivity in usual way: load arraylist of item database , use custom adapter show data. display listview (each row item ): date field1 field2 ... fieldn 2012/03/02 ... ... ... 2012/03/02 ... ... ... 2012/03/02 ... ... ... 2012/04/07 ... ... ... what want show row summary grouping date. example, want display previous list next one: date field1 field2 ... fieldn ** 2012/03/02 3 rows 2012/03/02 ... ... ... 2012/03/02 ... ... ... 2012/03/02 ... ... ... ** 2012/04/07 1 row 2012/04/07 ... ... ... so, question how can it? need implement own listview? or there feature of listview don't know yet? use expandablelistview instead, "** 2012/03/02 3 rows" , "** 2012/04/07 1 row" parent items , rest children items. here place can up: http://developer.android.com/reference/android/widget/expan...

sql - Trying to show zero instyead of #Error in visual studio -

Image
in visual studio want state if calculation box blank due there being no figures available on particluar project, show zero. my calculation simple: =(reportitems!textbox21.value) / (reportitems!textbox19.value) for wrote iif statement: =iif( isnothing(reportitems!textbox21.value) or isnothing(reportitems!textbox19.value), 0, ((reportitems!textbox21.value)/(reportitems!textbox19.value))) but still shows #error if there blank in either of textbox 21 or 19. see below picture. can advise on how fix this? can try use isnumeric instead of isnothing, =iif(isnumeric(reportitems!textbox21.value) , isnumeric(reportitems!textbox19.value),((reportitems!textbox21.value)/(reportitems!textbox19.value)), 0)

c# - Paying using PayPal account without redirection to PayPal's website -

let me explain situation. have mobile application allows user enter credit card details , make payment using paypal direct payment api. mobile application not operate using browser works via web services framework. i thinking of adding option. user enters paypal username , password mobile application. mobile application should make request paypal, buyer's paypal username , password passed parameters in addition transaction details. however, buyer should stay on mobile application. should not redirected paypal's website or other website. is possible? if yes, version of paypal api need use? thank in advance. i don't believe possible, paypal client should never have access username/password, , user confirms payment on paypal website itself

java - Thread.interrupt() Confusion -

i reading interrupts oracle docs. unable figure out following part. states that what if thread goes long time without invoking method throws interruptedexception? must periodically invoke thread.interrupted, returns true if interrupt has been received. example: for (int = 0; < inputs.length; i++) { heavycrunch(inputs[i]); if (thread.interrupted()) { // we've been interrupted: no more crunching. return; } } i scratching head understand, mean if thread goes long time without invoking method throws interruptedexception? secondly, usage of thread.interrupted(), way, thread can send interrupt itself? whats practical usage of scenario? thanks. this technique keep thread available interruption. thread.interrupted() : checks whether present thread (itself) interrupted other thread , clears interrupted status flag. asks whether interrupted exit doing while performing big big task , not listening someone. imagine have happened...

android - StrictMode.ThreadPolicy.Builder Purpose and Advantages? -

i referred strictmode.threadpolicy.builder android document strictmode.threadpolicy.builder . i have no clear idea strictmode.threadpolicy.builder . when have use class strictmode.threadpolicy.builder . what advantage , purpose of strictmode.threadpolicy.builder . i want detailed explanation for strictmode.threadpolicy policy = new strictmode.threadpolicy.builder() .detectall() .penaltylog() .build(); strictmode.setthreadpolicy(policy); the advantages of defining stictmode policies within application force you, in development phase, make application more behaved within device running on: avoid running consuming operation on ui thread, avoids activity leakages, , one. when define these in code, make application crashes if defined strict polices has been compromised, makes fixes issues you've done (the not behaved approaches, network operations on ui thread). i following first when start new project: public class myapplication extends application { private s...

.net - Executing SSIS package from WCF service -

i trying execute ssis package wcf service, initialising ssis variable using method(runpackage(input1, input2)) . input 1: path of excel file, input 2: package path when deploy wcf on iis , call method (runpackage(input1, input2)) using web service, getting package failed message. wcf , ssis packages @ server1 (db server), excels @ sever2. server2 has access server1 following code in runpackage method in wcf strxlpath = @"\\server1\excel1.xlsx"; strpackagepath = @"e:\package.dtsx"; public static string runpackage(string strxlpath, string strpackagepath) { string strresult = "fail"; try { package pkg; application app; dtsexecresult pkgresults; //microsoft.sqlserver.dts.runtime.configuration cnfg; strpackagepath = strpackagepath.replace("e:", "\\\\server2"); //check if excel exists ...

reflection - Can define variables as references to local classes defined in another program? -

i have program zprog1_test define local class lcl_prog1_helper . i have second program zprog2_test i'd define variable reference class. isn't there syntactic possibility me this? or in theory doable rtti classes cl_abap_classdescr ? extra why i'd because have custom form zmm_medruck needs know if me32n document it's printing has been changed not saved. i've figures out exact objects properties need interogate, of them defined @ design time common interfaces, if_serializable_mm , , need cast them local classes instances know these objects going be, \function-pool=megui\class=lcl_application. i of course try dynamic method call , not care anything, since i'm here thought i'd ask thing first. as far know, not possible. accessing local class dynamically easy (well, relatively easy), referring statically - not far know. you'll have call methods dynamically.

asp.net mvc - ModelState.AddModelError dosen't show error -

my modelstate.addmodelerror dosen't show error. checked username , show error when been duplicated. when use breakpoint see modelstate.addmodelerror filled, doesn't show error msg. my code: controller: [httppost] public actionresult register(tbl_user model) { if (modelstate.isvalid) { if (myclass.isusernameduplicate(model.username) == true) { this.modelstate.addmodelerror("username", "the username duplicate"); return view(model); } else { myclass.creatuser(model.username, model.password_user, model.nam); } } return view(model); } view : @html.validationsummary(true) @html.validationmessagefor(model => model.username) @html.textboxfor(m => m.username, new {@class = "input", @placeholder = "*enter user name" }) you need call addmode...

java - ArrayList<String> Android to PHP. Insert MySQL -

i have problems trying send arraylist android php , insert arraylist mysql table. so, first of send list parameters. list<namevaluepair> list = new arraylist<namevaluepair>(); list.add(new basicnamevaluepair("tag", "registercall")); list.add(new basicnamevaluepair("hourmatch", hourmatch)); list.add(new basicnamevaluepair("datematch", datematch)); list.add(new basicnamevaluepair("listplayers", seleccionados .tostring())); //arraylist<string> list.add(new basicnamevaluepair("idmatch", idmatch)); if print parameters list: [tag=registercall, hourmatch=0931, datematch=2013-08-07, listplayers=[8, 10], idmatch=7]. and in php, collect parameters , send function. if ($tag == 'registercall') { $hourmatch = $_post['hourmatch']; $datematch = $_post['datematch']; $idmatch = $_post['idmatch']; $listplayers...

text mining - list of word frequencies using R -

i have been using tm package run text analysis. problem creating list words , frequencies associated same library(tm) library(rweka) txt <- read.csv("hw.csv",header=t) df <- do.call("rbind", lapply(txt, as.data.frame)) names(df) <- "text" mycorpus <- corpus(vectorsource(df$text)) mystopwords <- c(stopwords('english'),"originally", "posted") mycorpus <- tm_map(mycorpus, removewords, mystopwords) #building tdm btm <- function(x) ngramtokenizer(x, weka_control(min = 3, max = 3)) mytdm <- termdocumentmatrix(mycorpus, control = list(tokenize = btm)) i typically use following code generating list of words in frequency range frq1 <- findfreqterms(mytdm, lowfreq=50) is there way automate such dataframe words , frequency? the other problem face converting term document matrix data frame. working on large samples of data, run memory errors. there simple solution this? try this data(...

plot - Colorbar repeating range labels in Matlab -

Image
i'm plotting data in matlab , when add colorbar plot range labels drawn repeatedly plot. here minimal working example: events = 1000000; x1 = sqrt(0.05)*randn(events,1)-0.5; x2 = sqrt(0.05)*randn(events,1)+0.5; y1 = sqrt(0.05)*randn(events,1)+0.5; y2 = sqrt(0.05)*randn(events,1)-0.5; x= [x1;x2]; y = [y1;y2]; %for linearly spaced edges: xedges = linspace(-1,1,64); yedges = linspace(-1,1,64); histmat = hist2(x, y, xedges, yedges); figure; pcolor(xedges,yedges,histmat'); colorbar ; axis square tight ; you can hist2 -function here: http://www.mathworks.com/matlabcentral/fileexchange/9896-2d-histogram-calculation/content/hist2.m this running code: if remove colorbar command code above get: any ideas why problem occurring? have met problem before also... operating system 64-bit windows 7 enterprise , have matlab r2012b (8.0.0.783) thank :) as user @nkjt stated answer problem can found here: http://www.mathworks.nl/matlabcentral/answers/53874 ...

Bootstrap button group malfunction when they have tooltips -

i have single group button tooltip enabled each button. on hover in last button of group, tooltip causes misalignment , border of button no longer rounded. know tooltip style overriding button style cannot find is. demo: bootply update: fixed changing <a> element <button> elemnt , using custom style button: <button class="btn btn-small btn-danger" data-toggle="modal" title="unlink" data-target="#@item.woworkpermitid"><i class="icon-resize-full icon-white"></i></button> css: .btn-group > .btn:last-of-type { -webkit-border-top-right-radius: 4px; -moz-border-top-right-radius: 4px; border-top-right-radius: 4px; -webkit-border-bottom-right-radius: 4px; -moz-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } demo --> bootply related post --> twitter bootstrap tooltips on buttons inside table not displaying correctly try ...

Correctly displaying a unicode string from a variable in Python -

i have python script reads text excel file , assigns string variable. one of these strings follows: "merhaba öncelikle size iyi çal\u0131\u015fmalar dilerim.ba\u015f\u0131mdan geçen bir" i've been able display correctly when doing this: print u"merhaba öncelikle size iyi çal\u0131\u015fmalar dilerim.ba\u015f\u0131mdan geçen bir" when run in script this: merhaba öncelikle size iyi çalışmalar dilerim.başımdan geçen bir but can not figure out how convert/display correctly string when receiving them output excel file. i've tried this: mystring = "merhaba öncelikle size iyi çal\u0131\u015fmalar dilerim.ba\u015f\u0131mdan geçen bir" print mystring.decode("unicode_escape") but prints out: merhaba öncelikle size iyi çalışmalar dilerim.başımdan geçen bir

c++ - Why doesn't GCC compile this code? -

i java, python programmer trying fiddle c++. have following code snippet - #include <windows.h> bool isinsidevmware() { bool rc = true; __try { __asm { push edx push ecx push ebx mov eax, 'vmxh' mov ebx, 0 // value not magic value mov ecx, 10 // vmware version mov edx, 'vx' // port number in eax, dx // read port // on return eax returns version cmp ebx, 'vmxh' // reply vmware? setz [rc] // set return value pop ebx pop ecx pop edx } } __except(exception_execute_handler) { rc = false; } return rc; } i getting following compile error - __try' undeclared (first use function) __except' undeclared (first use function) what vague message mean? because try undeclared should try use first?? edit: ide - codeblocks compiler - gcc this code relies on microso...

mapreduce - hadoop: reduce happened between flush map output and finish spill before maps done -

i'm new hadoop, , i'm trying examples wordcount/secondsort in src/examples. wordcount test environment: input: file01.txt file02.txt secondsort test environment: input: sample01.txt sample02.txt which means both 2 test have 2 paths process. print log info trying understand process of map/reduce. see what's between starting flush of map output , finished spill 0 : wordcount program has 2 reduce task before final reduce while secondsort program reduce once , it's done. since these programs "small", dont think io.sort.mb/io.sort.refactor affect this. can explain this? thanks patience broken englisth , long log. these log info (i cut useless info make short): wordcount log: [hadoop@localhost ~]$ hadoop jar test.jar com.abc.example.test wordcount output 13/08/07 18:14:05 info mapred.fileinputformat: total input paths process : 2 13/08/07 18:14:06 info mapred.jobclient: running job: job_local_0001 13/08/07 18:14:06 info util.proces...

getParameter returns null in the servlet -

this question has answer here: http request parameters not available request.getattribute() 1 answer i trying pass string jsp servlet via href. use this <a href="myservlet?select=title1"> title1 </a> then in servlet trying value of select this string s = request.getparameter("select"); but returns null . why that? thank you! edit post code of servlet protected void processrequest(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { string useroption = request.getattribute("select"); system.out.println("select is:" + useroption); //in console get: select is:null that should not string useroption = request.getattribute("select"); please understand attributes not parameters it should string useroption = request.ge...

how decode this JSON answer form server? -

i have json response server, don't how decode , read. {"data":"hx8l^^\u0002@[zun\\r[\\a\\6v\u0017\fq\u0012\u0004p^u_\u0016\u0005\u0006\u0017\u0000'fwpm\u0003lz\u0010ghsf\u000e\u0012ue\u0012\t\u000fm#:\u0003a~vkb\u0015\u001do\u0014\u0012\u0006pq\u0005\u0005\u0010\u000b\u0001\u001d/\u0000a\u0014ke\u0015y\u0004l|@k&\t\u0017uqj>`r\fbk)yf\u0015zo\u000bfg'mo\b_mob\n\u0004kyqo\trkuyjcz\u0016ubb|dt\u0012xt\f\u0006h\u001cz\u00162\u0003t\u001ewj4azw\u001dr\u00104wz\u0001w\u0013\u0000lbs@!@\u00055#q'x\u0005-n@@\u0010\\+d\u0005\u0003\u0018h+jl..dk\u0005\u000bre\r\u0013yk&]r7\u0010k\u0016e\u0013q\u0003\u0015\n\u0002\u0012p\u0002\u0016$&@... is there converter? thx

Internal server error 500 when I am trying to get all `groupid` from `ektron` in .net (c#) -

my code: httpwebrequest httpwreq = (httpwebrequest)system.net.webrequest.create(domainurl + "/workarea/webservices/webserviceapi/user/user.asmx/getallusergroups"); asciiencoding encoding = new asciiencoding(); string postdata = "orderby=id"; byte[] data = encoding.getbytes(postdata); httpwreq.method = "post"; httpwreq.contenttype = "application/x-www-form-urlencoded"; httpwreq.contentlength = data.length; using (stream stream = httpwreq.getrequeststream()) { stream.write(data, 0, data.length); } httpwebresponse response = (httpwebresponse)httpwreq.getresponse(); string responsestring = new streamreader(response.getresponsestream()).readtoend(); getxmlvalue1(responsestring); tested above piece of code @ end (ektron v9),and it's working fine. the issue may ektron site referring. check whether ektron website make post request accessible or not.

iphone - What are "page controller" and "page view controller"? -

i'm new ios, want know deference between "page controller" , "page view controller" , how use uiimage , uiimageview?? please give example , link same... thank in advance !! i think understand what's difference between page controller , pageviewcontroller other answer. i'm giving example implement pageviewcontroller using scrollview, can use uiiimageview on top of scrollview. check out link: http://www.edumobile.org/iphone/iphone-programming-tutorials/pagecontrol-example-in-iphone

how to remove listener from cell editing plugin in ExtJs? -

can please me out here ? i want remove beforeedit listener @ runtime cell editing plugin. i added listener on plugin using following code. var gridplugin = ext.getcmp(gridid).getplugin(pluginid); gridplugin.addlistener(eventname,function(editor,e,eopts){callbackfunction(editor, e, eopts);}); but not able remove listener. i trying following code. var gridplugin = ext.getcmp(gridid).getplugin(pluginid); gridplugin.removelistener(eventname); thanks in advance, ext.grid.plugin.cellediting.removelistener 's signature is: ( eventname, fn, [scope] ) (see documentation) means, apart supplying event name listener should detached, need provide listener function well. code should work be: var gridplugin = ext.getcmp(gridid).getplugin(pluginid), listnerfunction = function(editor,e,eopts){callbackfunction(editor, e, eopts);} gridplugin.addlistener(eventname,listnerfunction); then var gridplugin = ext.getcmp(gridid).getplugin(pluginid); gridplugin.removeli...

How to set up Entity Framework to map two classes to the same table -

i've been bumbling along ef5 cant seem 2 domain classes map single database table. the error is: message: "the type 'basd.erp.wms.purchasing.supplierprofile' has been configured entity type. cannot reconfigured complex type." this dbcontext: public class purchasingcontext : disconnectedentitycontext { public dbset<suppliercard> suppliers { get; set; } public dbset<purchasecategory> purchasecategories { get; set; } public purchasingcontext() : this("basd.erp.wms") { } public purchasingcontext(string connectionstringname) : base(connectionstringname) { } public static purchasingcontext getinstance(efdataprovider provider) { return new purchasingcontext(provider.connectionstringname); } } } these classes: namespace basd.erp.wms.purchasing { public class suppliercard : contactcard, isuppliercard { private icollection<purchasecategory> _purchasecategor...

java - Lagg fix BufferedImage -

is there image variable buffered image because when launch aplication, reads text document map, laggs lot my code whith bufferedimage(sorry not english): for(int = 0; < pole[0].length; i++) { for(int j = 0; j < pole.length; j++) { if(pole[j][i] == 1) { g.setcolor(color.red); try { // g.fillrect(j*40, i*40, 40, 40); wall = imageio.read(classloader.getsystemresource("images/wall.gif")); g.drawimage(wall, j*40, i*40, null); } catch (ioexception ex) { joptionpane.showmessagedialog(null, "error: "+ex.getmessage()); } } } } you load image i*j times, when need load once , use same reference each tile. i.e. image wall = imageio.read("..."); for(int i=0;i < ...) for(int j=0;j < ...) g.drawimage(i*40, j*40, wall...

php - Alternative for htmlentities($string,ENT_SUBSTITUTE) -

i got bit of stupid question; currently making website company on server has bit outdated php version (5.2.17). have database in many fields varchar characters ' é ä è ê ' , on, have display in html page. so version of php outdated (and not allowed updated because there parts of site must keep working , whom have no acces edit them) can't use htmlentities function ent_substitute argument, because added after version 5.4. so question is: does there exist alternative htmlentities($string,ent_substitute); or have write function myself kinds of strange characters, incomplete anyway. define function handling ill-formed byte sequences , call function before passing string htmlentties. there various way define function. at first, try uconverter::transcode if don't use windows. http://pecl.php.net/package/intl if willing handle bytes directly, see previous answer. https://stackoverflow.com/a/13695364/531320 the last option develop php ext...

Java clipboard as stack in paste override -

i have done research, no useful results found. here deal, i'm writing 'new' clipboard works stack instead of 'area'. , i'm brave or stupid enoght in java. far in tests see if possible have managed create stack behavior. problem i'm getting sometimes, when paste top of stack (pop operation), doesn't pop or other reason pastes twice. example: if copy 3 words: carlos, lucas, eastwood stack clipboard behaves @ paste: eastwood, eastwood, lucas, carlos i'm using jnativehooks reading system keypresses , determining when user pasting. think happening system pasting before code... well, here code anyway (it test, explains why badly commented): import java.awt.toolkit; import java.awt.datatransfer.clipboard; import java.awt.datatransfer.transferable; import java.util.stack; import org.jnativehook.globalscreen; import org.jnativehook.nativehookexception; import org.jnativehook.nativeinputevent; import org.jnativehook.keyboard.nativekeyevent; import...

wordpress - Working with nested recursive shortcodes -

i have these 2 functions: add_shortcode('section_block_container','dos_section_block_container'); function dos_section_block_container($atts, $content = null) { $content = do_shortcode($content); echo '<ul class="list-unstyled list-inline">' . $content . '</ul>'; } add_shortcode('section_block','dos_section_blocks'); function dos_section_blocks($atts, $content = null) { // define attributes , defaults extract( shortcode_atts( array ( 'first' => false, 'color' => '', 'icon' => '', 'title' => '', ), $atts ) ); ?> <li> <a href="" style="background-color: <?php echo $color; ?>" title="<?php echo $title; ?>" class="section-block show-grid col-12 col-sm-3 <?php // echo ($first == true ? 'col-offset-3 ' : '...

Convert varchar data to datetime in SQL server when source data is w/o format -

how can convert varchar data '20130120161643730' datetime ? convert(datetime, '20130120161643730') not work. however, convert (datetime, '20130120 16:16:43:730') works. guess needs data in correct format. is there valid way can used convert datetime directly unformatted data ? my solution : declare @var varchar(100) = '20130120161643730' select concat(left(@var,8),' ',substring(@var,9,2),':',substring(@var,11,2),':',substring(@var,13,2),':',right(@var,3)) it works fine. however, i'm looking compact solution. you can make little more compact not forcing dashes, , using stuff instead of substring : declare @var varchar(100) = '20130120161643730'; set @var = left(@var, 8) + ' ' + stuff(stuff(stuff(right(@var, 9),3,0,':'),6,0,':'),9,0,'.'); select [string] = @var, [datetime] = convert(datetime, @var); results: string dateti...

c# - Visual Studio 2003 can't navigate to the definition of "IIdentity" or "StringTable" -

i have following code: using system; using system.collections; using system.security; using system.security.principal; public class systemprincipal : iprincipal { private iidentity _identity; private stringtable _roles; public systemprincipal(iidentity id, stringtable roles) { _identity = id; _roles = roles;; } public iidentity identity { { return _identity; } } public bool isinrole(string role) { bool result = false; if (null != _roles) { result = _roles.contains(role); } return result; } } i want see definition of iidentity or stringtable right click , choose goto definition "cannot naviate to" iidentity or stiringtable. based on google soultion rebuilt project did not solve issue.

javascript - Google Places and ZERO_RESULTS -

i've been working on simple google places search , cannot zero_results. makes no sense me @ point map working , displays markers database within separate ajax function. i've logged objects , variables , seem fine. why success callback go right else statement zero_results? $( "#submit3" ).click(function(e) { e.preventdefault(); findplaces(); $('#results').text("triggah3!"); }); function findplaces() { var lat = document.getelementbyid("latitude").value; var lng = document.getelementbyid("longitude").value; var cur_location = new google.maps.latlng(lat, lng); // prepare request places var request = { location: cur_location, radius: 50000, types: 'bank' }; // send request service = new google.maps.places.placesservice(map); service.search(request, createmarkers); } // create markers (from 'findplaces' function) function createmarkers(...

c# - BindingFlags.OptionalParameterBinding varying behaviour in different frameworks. Bug in .NET? -

i've tried force activator.createinstance use constructor default parameters. i've found suggestion, repeated few times on (first comment) http://connect.microsoft.com/visualstudio/feedback/details/521722/system-activator-createinstance-throws-system-missingmethodexception-with-constructor-containing-an-optional-parameter i wanted run on mono , didn't work, throwing missingmethodexception . before filing bug i've made experiment on .net 4.5: class program { static void main(string[] args) { new a(); activator.createinstance(typeof(a), bindingflags.createinstance | bindingflags.public | bindingflags.instance | bindingflags.optionalparambinding, null, new object[] {type.missing}, null); } } class { public a() { console.writeline("first"); } public a(int = 5) { console.writeline("second"); } } of course, result p...

jquery mobile - JQueryMobile - position and size of select menu -

i working on jquerymobile page. page contain select element (dropdown) custom menu. trying position menu right below select button , change width width of select button. further stylizing follow well. in firebug figured out jqm changes css classes of select menu (here: select-choice-1-listbox-popup) position attributes. thought might proper approach element , change top attribute. doesn't work though. guess code executed because first alert not show value "top" attribute. <script type="text/javascript"> function positionmenu() { alert(document.getelementbyid('select-choice-1-listbox-popup').style.top); // prints "" document.getelementbyid('select-choice-1-listbox-popup').style.top="300px"; alert(document.getelementbyid('select-choice-1-listbox-popup').style.top); // prints "300px" } </script> [...] <div onclick="positionmenu();" data-role=...

database - CakePHP, number of views -

suppose, db table in project : <table> <tr> <th>id</th> <th>title</th> <th>description</th> <th>created</th> <th>modified</th> <th>........</th> </tr> <tr> <td>1</td> <td>some title</td> <td>some description</td> <td>7/8/2013 8:50</td> <td>7/8/2013 8:50</td> <td>........</td> </tr> </table> now, want number how many times record 1 (id=1) has been seen. , in cakephp. there easy way information ? know created , modified 2 fields values automatically generated cakephp. so, there field or can used here ? marked ......... . or, there other way ? thanks. there's nothing built-in, it's not hard make yourself. (the hard part not increment counter when search engine bots access page if it's reachable them.) in databa...

c++ - rapidjson: working code for reading document from file? -

i need working c++ code reading document file using rapidjson: https://code.google.com/p/rapidjson/ in wiki it's yet undocumented, examples unserialize std::string, haven't deep knowledge of templates. i serialized document text file , code wrote, doesn't compile: #include "rapidjson/prettywriter.h" // stringify json #include "rapidjson/writer.h" // stringify json #include "rapidjson/filestream.h" // wrapper of c stream prettywriter output [...] std::ifstream myfile ("c:\\statdata.txt"); rapidjson::document document; document.parsestream<0>(myfile); the compilation error state: error: 'document' not member of 'rapidjson' i'm using qt 4.8.1 mingw , rapidjson v 0.1 (i try upgraded v 0.11 error remain) the filestream in @raanan's answer apparently deprecated. there's comment in source code says use filereadstream instead. #include <rapidjson/document.h> #include ...

android - Real-time wireless sensor data transfer. WiFi or Bluetooth? TCP or UDP? -

in project, have been using bluetooth module (panasonic pan1321) transfer real-time data sensors android tablet @ approx 200hz (this rate @ data packets transferred). considering use wifi instead. understanding has longer range , more robust. plus many wireless systems out there use easier integrate system existing setups. intend use bluegiga wf121 wifi node. module offers tcp or udp communication. have no knowledge of tcp or udp. appreciate if has answers following questions: is worthwhile shift bluetooth wifi? will able point-to-point data transfer between wifi module , android tablet (just bluetooth module)? on wifi can achieve data transfer rate of upto 500hz data packet size of approx 80 120 bytes? 500hz more enough real-time feedback in project 200hz suffice. having lower data transfer rate possible increase memory requirement embedded system , can bottle-neck. there time-stamp included in data packet timing of packets not important order of packets more important. pac...

node.js - How to read PassportJS session data? -

i think don't quite understand passport.session meant for. says nothing on configuration page . what need save person's data once he's been authenticated, use name in required file, put socket.io code. i've read on google , here, , couldn't find need. don't know how read connect.sess has data once user logged-in. so line do? app.use(passport.session()); note - don't use db. user logs-in id , name, that's pretty basic. i'm not sure if case, finished writing blog uses node , passport, , whenever user logged in credentials stored in req.user (assuming req request json called). might want check there.

regex - Converting a string that is a bit Lisp-like to a Ruby array -

i have string this: s = '+((((content:suspension) (content:sensor))~2) ((+(((content:susp) (content:sensor))~2)) (+(((content:height) (content:control) (content:sensor))~3)) (+(((content:height) (content:sensor))~2)) (+(((content:level) (content:control) (content:sensor))~3)) (+(((content:rear) (content:height) (content:sensor))~3)) (+(((content:ride) (content:height) (content:sensor))~3))))' i'd convert array of strings like: ["suspension sensor", "susp sensor", "height control sensor", "height sensor", "level control sensor", "rear height sensor", "ride height sensor"] here ugly bit of code accomplishes that: a = s.gsub('content:', '') \ .gsub(/\+/, '') \ .gsub(/~\d/, '') \ .gsub(/\((\w+)\)/) { $1 } \ .gsub(/\(([^\(]*[^\)])\)/) { "#{$1}" } \ .gsub(/[\(\)]/,', ') \ .split(/\s?,\s?/) \ .reject {|x| x.strip == ''} i thi...

Simple youtube javascript api 3 request not works -

i've tried write simple youtube request search video youtube javascript api v3. this source code: <!doctype html> <html> <head> <script type="text/javascript"> function showresponse(response) { var responsestring = json.stringify(response, '', 2); document.getelementbyid('response').innerhtml += responsestring; } // called automatically when javascript client library loaded. function onclientload() { gapi.client.load('youtube', 'v3', onyoutubeapiload); } // called automatically when youtube api interface loaded function onyoutubeapiload() { // api key intended use in lesson. gapi.client.setapikey('api_key'); search(); } function search() { var request = gapi.client.youtube.search.list({ part: 'snippet', q:'u2' }); ...

animation - re-binding a click event / toggling between 2 elements, simple Jquery Quiz -

so im bit stuck on working on; i'm brand new jquery , javascript world , i'm sure there more efficient way this, now, have. basically when user clicks on 'answer' element animate on page. there 2 answers matching elements animate if corresponding 'answer' clicked. right now, when user clicks on 1 answer multiple times, continues animate; need when user clicks on answer, animates once, , stops, user either leaves it, or when click other' answer', performs animation, becomes re-binded reclick. sort of toggling , forth between 2 answers/corresponding animations. i'm having trouble re-binding becomes available click again. sort of in loop. hope im explaining ok! can point me in right direction this. here js, fiddle below of im at. /*answer1*/ $('ul#quiz li:nth-child(2)').on("click", function() { $(this).addclass('active'); $(this).siblings().addclass('deactive'); $(this).siblings().removeclass(...

javascript - How to add both toggle and validate options to x-editable? -

i use x-editable inline editor http://vitalets.github.io/x-editable/docs.html i want toggle inline form other link: $("#how").click(function(e) { e.stoppropagation() e.preventdefault() $("#com").editable({ 'toggle', validate: function(value) { if($.trim(value) == '') { return 'the content can not blank!'; } } }) }) but not work, want know how pass both toggle , validate option. seperate options declaration , 'toggle' part trick: $("#how").click(function(e) { e.stoppropagation(); e.preventdefault(); $("#com").editable({ validate: function(value) { if($.trim(value) == '') { return 'the content can not blank!'; } } }); $("#com").editable('toggle'); }); hope helpful others :)

Create a hierarchical dynamic grid with GWT -

i'm trying create grid in gwt representing hierarchical data. columns different levels same , represent if product available category or not. something that: | b | c | d + product 1.1 x x x + product 1.2 x x x + product 1.3 x x + product 2.1 x + product 2.2 x ... i though use celltable , add handlers show/hide rows, how shall manage hiding descendant? basically, work in mvc. controller catches event, update model, , asks dataprovider refresh display. the simplest can think of when catch event asking hide descendant of, instance, product 2.1, cycle through model objects (a list guess) , update child element accordingly. refresh celltable using appropriate methods on dataprovider.

html - How to - If using IE8 don't load web content -

i have web site functional ie8. have web site displaying banner takes visitor upgrade ie. i'd more... what i'd is, display banner in addition message says "sorry browser not meet requirements view site". don't want load other page content. is there way don't load rest of page in ie if statement? <!--[if lt ie 8]> <div style=' clear: both; text-align:center; position: relative;'> <a href="http://windows.microsoft.com/en-us/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode"><img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="you using outdated browser. faster, safer browsing experience, upgrade free today." /></a> </div> -- here want don't load else. -- maybe automatically redirect blank page? <![endif]--> the...

scala - Better solution to case class inheritance deprecation? -

i working through (admittedly old) programming scala [subramaniam, 2009] , encountered troubling compiler warning when working through section 9.7 "matching using case classes" (see below). here solution devised based on interpretation of error message. how improve upon code solution closer original intent of book's example? particularly if wanted use sealed case class functionality? /** * [warn] case class `class sell' has case ancestor `class trade'. * case-to-case inheritance has potentially dangerous bugs * unlikely fixed. encouraged instead use * extractors pattern match on non-leaf nodes. */ // abstract case class trade() // case class buy(symbol: string, qty: int) extends trade // case class sell(symbol: string, qty: int) extends trade // case class hedge(symbol: string, qty: int) extends trade object side extends enumeration { val buy = value("buy") val sell = value("sell") val hedge = value("hedge...

Import error for large negative numbers from CSV to Access using TransferText -

Image
i'm importing data csv file access table. number like -21000000 (-2.1e7). i'm using transfertext import. docmd.transfertext acimportdelim, , "matching report temp", source_folder & "\" & source in "matching report temp" table, field set double. import generates type conversion failure. however, when open csv file in excel , copy offending row, can use paste append add table manually - number doesn't exceed capacity of field. as far can tell, happens large negative numbers. smaller numbers, , positive numbers of same magnitude seem import fine. know can specify import specification in transfertext, don't see way set field type double. how can around problem? don't want have manually track down import errors , append them hand. don't let transfertext create access table you. create access destination table first , assign field types need. when run transfertext , csv data appended existing tabl...

Copy a mysql database from one server to another PHP cron Job automated -

ok first off not backup job, , know using phpmyadmin , on. what have live server , test server, people work on live one, modifying it. want database on live server copied test server every night. does have php script run either copy down whole thing (or @ least specific tables)? i'm not confident using command line if there way of doing way pretty specific instructions :p i have dug around seems suggesting doing manually or using third party tools. any appreciated. you this: in mysql host machine: 1- create .sh file 2- inside of sh, put: - mysqldump -u myuser -p mypass mydatabasename > mydumpfile.sql - scp mydumfile.sql user@remote_host:remote_dir 3- add sh cron job, daily execute (or meets requeriments) in remote machine: 1- 1 sh script file(mysqldumpfile.sql) in specific dir 2- line : mysql -u remotemysqluser -p remotemysqlpass database < mydumpfile.sql 3- rm mydumpfile.sql 4- add sh on daily cron 1 or 2 hours past host cron.

javascript - triggering method on a formerly invisible element -

i use 2 jquery plugins slidecontrol , icheck , use script $(document).ready(function(){ $('.slidecontrol').slidecontrol({ 'lowerbound' : 1, 'upperbound' : 10 }); $('.form-horizontal input').icheck({ checkboxclass: 'icheckbox_flat', radioclass: 'iradio_flat' }); $("input").on("ifchecked",function(e){ $(this).parent().next().removeclass("invisible"); }); }); $(this).parent().next() has class .slidecontrol , should display slider, doesn't work. information, ifchecked corresponds check event customized icheck api. tried add $("input").on("ifchecked",function(e){ $(this).parent().removeclass("invisible"); $('.slidecontrol').slidecontrol({ 'lowerbound' : 1, ...

Using PHP $_GET to grab data and define content -

i want use php 's $_get in url grab data define content within page. basically, want url this- /page.php?p=1 then, php automatically include ../content/1.txt later in code, because 1 after p= . if url /page.php?p=2 , include ../content/2.txt because in url. want automatically, , within page, basic skeleton can put together, , file included in skeleton. want php automatically, instead of having define every single p= , have that. try this... <?php if(isset($_get['p'])){ $filename = $_get['p']; /* validate user input here */ $filename = "../content/" . $filename . ".txt"; //include file include($filename); //or echo link file echo "<a href=\"" . $filename . "\">link</a>"; //or echo file's contents echo file_get_contents($filename); } ?>

javascript - Typescript, signalR and date in an object -

i have strange problem , unsure on causing , not sure how fix in clever way. i have signalr app sends object, contains date client. client written in typescript, although not sure if has influence on or not. the date in object local date, not uat. need show date way, when date arrives in client converted. if client assumes date uat , converts automatically local time of client. i not want converted. want displayed is. 1 solution can think of convert date on server side (c#) string first , send on that. any better ideas? don't know if signalr doing or it's sort of std js behavior. c# developer , confuses me completely. i stuck in datetime issue how solved keep datetime in utc in server , let js handle conversion ,

click - jQuery event stops working after alert -

i have jquery event works fine until alert called. function calls script on the server adds item (inserts row in database) cart. 8 items allowed in cart, when user tries add ninth item, message returned jquery script that not allowed. here jquery script: jquery(document).on('click', 'a.add.module, a.remove.module', function(e) { if (blnprocessing == true) { return false; } else { blnprocessing = true; } e.preventdefault(); objlink = jquery(this); strlink = objlink.attr('href'); if (objlink.hasclass('add')) { objlink.text('adding'); } else { objlink.text('wait'); } jquery.get(strlink, function(data) { if (data.success) { if (data.success != true) { alert(data.success); // message says not allowed -- part stops script functioning further } else { // part works jquery('#cart...