Posts

Showing posts from August, 2013

unity3D: sprite animation bug? -

need little here. today notice everytime create sprite animation, unity3d don't ask animation filename anymore. automatically create animation file on same directory of sprites. is configurable in setting or bug? demo of problem have tried resetting window layout factory , checking if there's unusual in inspector window? something similar happened me while ago , fixed it. although wasn't same issue, might worth try.

ios - Stop removal of default text in textview (Swift) -

if have uitextview following text: "please finish sent..." and aim allow user edit textview can finish sentence, how can make can't remove text there before start editing aka "please finish sent"? update: have been able make users cannot remove initial text, there way make cannot type before initial text or inside it? has answered far! update: solved. stop people editing before , inside string added if range.location == 0 { return false } if (0 < range.location && range.location < count(string.utf16)) == true { return false } to shouldchangetextinrange function. help! this way can stop user remove initial text: import uikit class viewcontroller: uiviewcontroller, uitextviewdelegate { @iboutlet weak var textv: uitextview! override func viewdidload() { super.viewdidload() textv.text = "please finish sent" //set default text. textv.delegat...

javascript - Limit JS event to once per day per user -

i hoping limit event below once day per user. shadowbox appears when user tries leave page. don't want annoy user every time mouse leaves body, should happen first time on site each day. $('body').one('mouseleave', function() { $('.shadowbox').fadein(400) }); i have been advised using cookie way this, inexperienced in using cookies. thank you! you can set cookie in function expiry. good documentation available on here . basically, check , set in function. $('body').one('mouseleave', function() { var cookie = document.cookie; //you need find cookie need here (if exists, don't anything) return; //if exists $('.shadowbox').fadein(400) document.cookie = "mycookiename=true; expires=(datetime + 1day)" }); that way, fade , setting if there isn't cookie available.

java - How to build sphinx 4 cmu -

recently downloaded sphinx4. i opened zip , there shpinx4-master. appears project requires streamspeechrecognizer. searched , found in sphinx4-master there sphinx4-core in there there streamspeechrecognizer class. tried import project , can't. how can import sphinx4-core project? thanks in advance. look @ download page on wiki here, http://cmusphinx.sourceforge.net/wiki/download/ . but seems down @ moment. if can't access now, try accessing tomorrow.

matrix - R: Replacing x-axis labels with row names in a plot -

Image
i'm trying draw plot using below matrix. need row names in x-axis , draw plot each of columns in matrix. m1 m2 m3 m4 m5 m6 m7 m8 m9 m10 eps_0 1727 4 3 3 2 2 2 2 2 2 eps_0.1 1525 6 5 3 3 3 2 2 2 2 eps_0.2 1487 9 5 4 3 3 3 2 2 2 eps_0.3 1423 12 4 4 3 3 3 3 2 2 eps_0.4 1406 12 6 5 3 3 3 3 2 2 eps_0.5 1383 11 7 6 4 3 3 3 2 2 eps_0.6 1365 12 7 5 5 5 4 4 2 2 eps_0.7 1357 13 6 6 5 4 3 3 2 3 eps_0.8 1326 18 10 7 7 6 5 4 3 3 eps_0.9 1304 15 11 9 8 7 6 5 4 3 eps_1 1290 16 12 10 10 9 8 5 4 3 below code , graph created. layout(rbind(1,2), heights=c(7,1)) matplot(cldata, type="l", ylim=c(0,10), lwd=1, col=1:10, lty=1, xlab = "eps value", ylab = "no of clusters", main = "no of clusters eps-minptc combination") axis(1, at=0:10, labels=rownames(cldata),las=2) i couldn't directly row names ...

ios - Swift UITableViewController Reduce Loading Time -

i'm creating ios app in swift 1.2 master-detail uitableviewcontroller setup mastertableviewcontroller has cells push detailtableviewcontroller. detailtableviewcontroller has complex cells pull data web client generate chart, similar in apple's health app. takes 5-10 seconds data download. as result, there 5-10 second delay when cell in mastertableviewcontroller tapped before detailtableviewcontroller shown. i ideally push mastertableviewcontroller detailtableviewcontroller , display activity indicator on detailtableviewcontroller page dismissed when data downloaded. could point me in direction accomplish this? thank you! :) my code below pushing master detail. basic. feel if change in viewdidload or cellforrowatindexpath method, done easily. func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { tableview.deselectrowatindexpath(indexpath, animated: false) let detailvc = detailtableviewcontroller() detailvc.navigation...

java - Using Tailer and WatchService -

i use tailer , watchservice @ same time using code: agenttailerlistener listener = new agenttailerlistener(); tailer tailer; watchservice watcher = filesystems.getdefault().newwatchservice(); while (true) { watchkey watchkey; watchkey = paths.get("/tmp").register(watcher, entry_create); watchkey = watcher.take(); (watchevent<?> event : watchkey.pollevents()) { if (event.kind() == standardwatcheventkinds.entry_create) { tailsource = event.context().tostring(); system.out.println(tailsource); file file = new file("/tmp/" + tailsource); string end = "log"; if (file.getname().endswith(end)) { tailer = tailerfactory.createtailer(file, listener); (new thread(tailer)).start(); } } } watchkey.reset(); transport.close(); } but problem is: want check 1 file tailer (like stoping thread, can’t stop threa...

swift - Error Saving Text Views in NSUserDefault -

Image
i have 6 textviews , 1 button save text wrote in them. problem button save until forth textview, fifth , sixth not saved , copy text in third , fourth textviews example first text view - correctly saved second text view - correctly saved third text view - correctly saved fourth text view - correctly saved fifth text view - copy of text on third text view sixth text view - copy of text on fourth text view save button. it seems code ok , of text views linked , last 2 textviews still fail. my code here: @iboutlet weak var scrollview: uiscrollview! @iboutlet weak var labeluno: uilabel! @iboutlet weak var labeldos: uilabel! @iboutlet weak var primertextview: uitextview! @iboutlet weak var segundotextview: uitextview! @iboutlet weak var tercertextview: uitextview! @iboutlet weak var cuartotextview: uitextview! @iboutlet weak var quintotextview: uitextview! @iboutlet weak var sextotextview: uitextview! override func viewdidload() { super.viewdidlo...

sql - Count Rows using Multiple Select Statements -

purpose count rows multiple ( 9 in total ) select statements , display row count in application on php page. using oracle 11g db dont care selecting content right here - need rowcount. i haven't found great way count rows oracle , using select statements. what best way count rows multiple selects , oracle , display on php page ?? please provide examples this have, 9 times $query = oci_parse($conn, "select id" . " table a" . " (fieldx = 'n' , fieldy = 'y' , fieldz = 'y')"); oci_execute($query) or die(oci_error($query)); oci_fetch_all($query, $array); unset($array); $numberofrows1 = oci_num_rows($query); how can make more efficient ?? i try use field indexed or pk in select... this: $query = oci_parse($conn, "select count( * ) the_count" . " table a" . " fieldx = 'n'" . " , fieldy = 'y'" . " , fieldz = 'y'"); oci_execu...

Windows 10 not responding to uiAction 47 (SPI_SETWORKAREA) for user32.dll's SystemParametersInfo(uAction, uParam, lpvParam, fuWinIni) -

does have information on why windows 10 no longer allows set custom workarea using systemparametersinfo? using reserve screen space dock/bar applications. had luck getting working? for reference code on question works set custom work area in windows 8.1, 8, 7, , xp, no longer works on windows 10. how can resize desktop work area using spi_setworkarea flag? my alternative options seem using shappbarmessage (not preferable not allow modifying form opacity knowledge), or using setwindowshookex wh_callwndproc, seems require .dll injection external processes? i had similar issue, old program correctly set work area in windows 7 stopped working in windows 10. what worked me changing 'fwinini' argument (the last argument) spif_change spif_updateinifile. so, worked doesn't anymore: private const uint spif_sendwininichange = 2; private const uint spif_updateinifile = 1; private const uint spif_change = spif_updateinifile | spif_sendwininichange; systemparamet...

vba - Searching for 2 different strings in the same row -

Image
i need find 2 strings in spreadsheet. example omit: if both of strings in different rows example accept: if both of strings in same row , provide hyperlink combination of strings in in column (h) here code snippet: 'searching first string------------------------------------------- str1 = application.inputbox(prompt:="search value 1:", title:="search workbooks in folder", type:=2) if str1 = vbnullstring exit sub 'searching second string------------------------------------------- str2 = application.inputbox(prompt:="search value 2:", title:="search workbooks in folder", type:=2) if str2 = vbnullstring exit sub 'code accesing spreadsheet... each sht in activeworkbook.worksheets set c = sht.cells.find(str1, lookin:=xlvalues, lookat:=xlwhole, searchorder:=xlbyrows, searchdirection:=xlnext) set e = sht.cells.find(str2, lookin:=xlvalues, lookat:=xlwhole, searchorder:=xlbyrows, searchdirection:=xlnext) s...

html - Chrome loading the contents of a PHP file into a CSS file -

Image
my website loads on firefox, css disappears on chrome (although html loads). according console, seems because chrome loading contents of index.php main.css , bannertest.css so: on firefox, however, loads css expected: things have tried did not work: clearing history/cache/cookies adding text/css tags. did make text render little weirdly on firefox. css , html validation. fixed semi-colons , such. still doesn't work. what's problem? can't figure out steps take investigate what's going on more deeply, let alone figure out problem itself. no errors printed console far can tell. here index.php: <!doctype html> <!--[if lt ie 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if ie 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if ie 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if gt ie 8]><!--> <html...

javascript - Validating form input before submiting form -

i've learned make login form , planning validate 2 values ​​( email , password ) , use condition true or false . i have code this function uservalid(email) { var usr = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$\i/ ; return usr.test(email); }; function passvalid(password) { var passw = /^[a-za-z]\w{7,14}$/; return passw.test(password); }; the code above use validating email , password in form , think if passing value function (for example passing value email uservalid() function) return true/false. i plan create validating form or login form first check user email & password valid before submit (lets server). and think logic : if both values true login success if 1 of values true login failed if both values false login failed else (the value must empty or null) please insert email , password and on my question how create conditional statement above case, , of course...

python - Apache Spark: How to create a matrix from a DataFrame? -

i have dataframe in apache spark array of integers, source set of images. want pca on it, having trouble creating matrix arrays. how create matrix rdd? > imagerdd = traindf.map(lambda row: map(float, row.image)) > mat = densematrix(numrows=206456, numcols=10, values=imagerdd) traceback (most recent call last): file "<ipython-input-21-6fdaa8cde069>", line 2, in <module> mat = densematrix(numrows=206456, numcols=10, values=imagerdd) file "/usr/local/spark/current/python/lib/pyspark.zip/pyspark/mllib/linalg.py", line 815, in __init__ values = self._convert_to_array(values, np.float64) file "/usr/local/spark/current/python/lib/pyspark.zip/pyspark/mllib/linalg.py", line 806, in _convert_to_array return np.asarray(array_like, dtype=dtype) file "/usr/local/python/conda/lib/python2.7/site- packages/numpy/core/numeric.py", line 462, in asarray return array(a, dtype, copy=false, order=order) typeerror...

Detect browser support for CSS-animated SVG -

i playing around css -animated svg elements , came across problem though technologies, used, supported browsers combination not, i.e. css -animated div s work svg elements don't. wondering if there way detect if browser capable of animating svg elements using css . here jsfiddle example. works in latest versions of chrome, firefox , safari. when opening e.g. firefox 5 div rotates while rect doesn't. i wondering if there way detect if browser capable of animating svg elements using css simple answer: no. you can't detect if browser supports css-functionality css. the problem have encountered bothering every webdeveloper. still there ways around browser-support-problem: 1. can check "can use" compatibility: link: http://caniuse.com/ recommend functionality questionable animations. 2. use autoprefixer in workflow: with of autoprefixer don't have worry of time using css prefix -moz-, -webkit-, etc. tiny helper trick you, c...

android - MediaPlayer doesn't resume video after activity restart -

i have mediaplayer object uses surfaceholder object surface. there button on top of video takes me out of video website. when happens, pause player player.pause() . when return website, resume player player.start() . know surface gets destroyed when activity not displayed anymore, , gets recreated activity restarted. in surfacecreated() , set surface player again (since no longer has surface @ point), , resume. however, player restarts video beginning. i've tried commenting out line takes me website, see if pause/start works , resumes last spot. does. i'm not sure why behaviour doesn't happen when leave , re-enter video activity though. i tried using player.seekto() call. there no difference. in fact, when disabled button taking me site pausing video, seekto() call video started beginning despite position being not 0. the player object same way throughout. just because surface new 1 on restart, doesn't know or care of contents, it? player should managing...

php - Get buddypress group slug by passing its ID -

i able link specific buddypress group using groups id on template page. the admin inputs groups id custom field on page, using able generate groups slug create link it any appreciated to buddypress group slug group id: $group_id = 2; $group = groups_get_group( array( 'group_id' => $group_id ) ); $slug = $group->slug;

jquery - how to change the navigation item color when it will active? -

my css style have #nav { position: relative; } and html code <div class="header-background"> <!-- <div> --> <div id="logo">site title</div> <div id="nav"> <nav id="desktop-nav"> <a class="nav-item" href="#1">about</a> <a class="nav-item" href="#2">news</a> <a class="nav-item" href="#3">community</a> <a class="nav-item" href="#4">docs</a> </nav> </div> here have about,news,community,docs these 4 field..i want when click button suppose "about" time "about" button color change yellow , other buttons text color white ... so,i using jquery $(".desktop-nav a").live("click",function(){ $(".desktop-...

java - Uses of Multi-Dimensional Arrays -

Image
well beginning learn java have android app develop , have come across topic of multi-dimensional arrays. have noticed use draw simple tables. there other use , necessary topic future. -k.b there several "real life usages" of multi-dimension arrays. let me use images explain: a greyscale image of 4x4 pixels can represented this: int[][] myarray = { {236, 189, 189, 0}, {236, 80, 189, 189}, {236, 0, 189, 80}, {236, 189, 189, 80} }; it give output, if parsed image: however, if wanted actual colors instead of greyscales, have define set of rgb or cmyk values every single pixel. in other words, need array of values each pixel. , there have example of 3 dimensional array. this short examples should give little more insight of possible uses of multi-dimensional arrays, bear in mind usage areas countless, complete, or attempted thourough coverage of subject, pretty impossible. you ask ...

c++ - How to build boost Version 1.58.0 using Visual Studio 2015 (Enterprise) -

Image
i build boost 1.58.0 using (new) visual studio 2015 (enterprise). in past proceeded in following way: download boost 1.58.0 www.boost.org extract files (e.g. c:\thirdparty\vs2013\x64\boost_1_58_0 ) start visual studio 2013 x64 command prompt ( vs2013 x64 native tools command prompt ) change boost directory (e.g. cd c:\thirdparty\vs2013\x64\boost_1_58_0 ) execute .\bootstrap.bat execute .\b2 -j8 --toolset=msvc-14.0 address-model=64 --build-type=complete stage b2 -j8 --toolset=msvc-12.0 address-model=64 --build-type=complete stage --with-python but in vs2015 there not vs2015 command prompt. also vcvarsall.bat missing used setup vs2013 command prompt. how can compile source code of boost using vs2015? i tried install qt , had same issue: vcvarsall.bat missing. in case problem unchecked visual c++ common tools. i modified vs 2015 installation , added missing feature common tools visual c++ 2015 : after modification, file in c:\program files (x86)\microso...

java - Is bytecode manipulation safe -

performing bytecode manipulation using apis javaassist modify class files after compilation. but, if java code optimized can't modifications performed in wrong place? there ways avoid problem? story different between regular java , android? a typical java program compiled multiple times. in first step, java source code translated java byte code . in second step, java byte code translated machine code . the details of process of course dependent on virtual machine runs code. versions of java did example not include so-called just-in-time compiler. in case, byte code interpreted instruction instruction byte code manipulations of course have performance impact. not longer true. both openjdk's hotspot virtual machine android's art , dex runtimes perform optimizations of byte code. the javac compiler translates source code byte code performs few optimizations. should not worry performance impact of to-byte-code translation step. however, in cases, byte cod...

c++ - visual studio Cdialog that blocks execution -

i working c++ in visual studio. in our application, when user clicks button, cdialog box appears asking them select information. need use information in next line of code. there way block execution until dialog box has been quit out of? current solution split method, , add event listener 'ok' button calls second method. seems hacky though. so current solution has setup dialog box if (m_instancenumber == null) { m_instancenumber = new cinstancenumberdlg(this); m_instancenumber->create(idd_instance_range_dialog, this); m_instancenumber->showwindow(sw_show); } else{ m_instancenumber->showwindow(sw_show); } *clarification, code need wait execute directly below code. * then there event listener calls: void csolidhoopsframe::updateinstancerange() { trace1("%d",m_instancenumber->leftinstancerange()); trace1("%d",m_instancenumber->rightinstancerange()); trace("entered updateinstancerange"); } this prints updat...

php - adding hebrew value to sql using PDO -

i trying add hebrew value database using php's pdo class. after succeeding doing (by using: array(pdo::mysql_attr_init_command => "set names utf8" ), found out collate hebrew_ci_as added value. is there way prevent addition? thank you, , sorry bad english. php: right way source of information on this. basically check whether pdo-connection specifies charset in dsn: new pdo( 'mysql:host=your-hostname;dbname=your-db;charset=utf8', 'your-username', 'your-password', array( # ... pdo connection options ) ); make sure database tables set use utf8-collation, either phpmyadmin or using mysql-command line utility , following query: alter table table_name collate utf8; also might want consider using utf8mb4 suggested in book.

c# - Azure Storage private container blob to MemoryStream -

i'm running around in circles trying work out code download file azure storage private container memorystream. i have far... storagecredentials storagecredentials = new storagecredentials(*my storageaccountname*, *my storageaccountaccesskey*); cloudstorageaccount storageaccount = new cloudstorageaccount(storagecredentials, true); uri bloburi = new uri(featurefile.url); cloudblockblob blob = new cloudblockblob(bloburi); memorystream mem = new memorystream(); blob.downloadtostream(mem); it errors on last line with... the remote server returned error: (404) not found. however, work without error when container not private. any appreciated, thank you. please try following code: storagecredentials storagecredentials = new storagecredentials(*my storageaccountname*, *my storageaccountaccesskey*); cloudstorageaccount storageaccount = new cloudstorageaccount(storagecredentials, true); uri bloburi = new uri(featurefile.url); cloudblockblob blob = new clou...

javascript - Dynamically appended select menu with 1st option disabled automatically selects 2nd option -

i have hit weird case where, best of knowledge, 2 things should act same behave quite differently. if have 2 select menus on page, 1 static menu hardcoded in html , 1 appended body @ runtime jquery. disable first option in both select menus. when displayed both menus have first options disabled expected, dynamically appended menu has automatically set value second option while static menu still has first selected. http://jsfiddle.net/hm3xgklg/1/ html: <select class="dropmenu"> <option value="1">first</option> <option value="2">second</option> <option value="3">third</option> <option value="4">fourth</option> </select> javascript: var arr = [ {val : 1, text: 'one'}, {val : 2, text: 'two'}, {val : 3, text: 'three'}, {val : 4, text: 'four'} ]; var sel = $('<select class="dropmenu">').appendto(...

c# - Receiving touch events outside window -

how can receiving touch events outside window in wpf? mouse can use that: system.windows.input.mouse.capture(this, system.windows.input.capturemode.subtree); i need same behavior in answer touch

javascript - Ajax with new controller action rails -

i have created new micropost controller action called more receive ajax request. def more micropost=micropost.find_by(params[:id]) @answers=micropost.answers respond_to |format| format.html {redirect_to micropost} format.js end end and have created jquery file- more.js.erb $(".microposts").html("<%= escape_javascript(render('users/unfollow')) %>"); ` to replace content partial route file like resources :microposts, only: [:edit,:create,:destroy,:update,:show,:more] member :more end end and call javascript file in view with <%= link_to "load more",more_micropost_path(micropost),remote: true %> its working normal html request not ajax.nothing happens when click on link. saw similar questions asked fixes not working me. can me this. in advance.. error in firebug console `500 internal server error. nomethoderror in micropostscontroller#more. undefined method id nil:nilclass' the firebug err...

apache - how to remove query string from subdomain using htaccess? -

i have domain (example.com) created subdomain domain (sub.example). have php file in 'dir' folder in subdomain director. need change url http://sub.example.com/dir/view.php?id=10 to http://sub.example.com/dir/view.php/id/10 i how this? place .htaccess file? i beginer htaccess please me. rewriteengine on rewritecond %{http_host} ^sub.example.com$ [nc] in root .htaccess can have rule: rewriteengine on rewritecond %{http_host} ^sub\.example\.com$ [nc] rewriterule ^(\w+)/(.+?\.php)/(\w+)/(\w+)/?$ $1/$2?$3=$4 [l,nc,qsa]

javascript - undefined symbole using node-ffi in node js -

i have include c code in nodejs used node-ffi ,i created log.c : #include <stdio.h> #if defined(win32) || defined(_win32) #define export __declspec(dllexport) #else #define export #endif export void etat_periph(char periph[]){ file* fichier=null; fichier=fopen("log.txt","a+"); fputs(fichier,periph); fprintf(fichier,"**********end**********"); fclose(fichier); } export void user_connect(char user[] ,char date[]){ file* fichier=null; fichier=fopen("log.txt","a+"); fputs(fichier,"***********new user*********"); fputs(fichier,"user connected: %s at: %s",user,date); fclose(fichier); } i added file app.js: var ffi = require('node-ffi'); var libfile = ffi.library('./libfile', { 'etat_periph': ["void", ["string", "string"]], 'user_connect': ["void", ["string", "string"]] }); io.sockets.on('connectio...

ios - Display UIImage within an array with custom class in Swift -

i have custom class product defined class product: nsobject { var name: string var pricelabel: string var productimage: uiimage init(name: string, pricelabel: string, productimage: uiimage) { self.name = name self.pricelabel = pricelabel self.productimage = productimage super.init() } } and i've created array custom class let toy = [ product(name: "car", pricelabel: "$5.00"), product(name: "train", pricelabel: "$2.50") ] how insert uiimage array? need insert different picture each toy. thanks in advance there few way code example 1 work: // example 1: let toy = [ product(name: "car", pricelabel: "$5.00", productimage:uiimage(named: "myimage.png")!), ... ] // example 2: let product1 = product(name: "car", pricelabel: "$5.00") product1.productimage = uiimage(named: "myimage.png")! let toy = [ product1...

c# - Automapper foces subobjects to be mapped -

i trying map response object webservice class in project. thought automapper map sub objects automatically, not unless , until forcefully set member. why should ? mapper.createmap<getifpquoteresponse.quote, quotewsmodel>() .formember(dest => dest.carrierrate, opt => opt.mapfrom(src => src.carriers)) .formember(dest => dest.droppedcarriers, opt => opt.mapfrom(src => src.droppedrates)) .formember(dest => dest.memberplans, opt => opt.mapfrom(src => src.memberplans)); why wont automapper map su bobjects when mention class mapping mapper.createmap<getifpquoteresponse.quote, quotewsmodel>(); mapper.createmap<getifpquoteresponse.quote.carrier, carrierratemodel>(); mapper.createmap<getifpquoteresponse.quote.droppedcarrier, droppedcarriermodel>(); automapper map top level object. if class built in following way not work: class { b b; } class b { } class not know how map property b inside class a. to need create ...

mysql - SQL integer type -

i'm trying create simple table: create table booklended ( library_card_number integer not null , foreign key (library_card_number) references borrower (library_card_number), sequence integer unique, isbn_number int not null, foreign key (isbn_number) references book(isbn_number), librarian_id integer return_date date not null, checkout_date date not null ) and i'm having error: 7: unexpected token: integer in statement [create table booklended ( library_card_number integer not null , foreign key (library_card_number) references borrower (library_card_number), sequence integer] you trying give 2 constraints( not null,foreign key ) @ time. instead u can add foreign key @ end: try follwing create table booklended ( library_card_number integer not null , sequence integer, isbn_number int not null, librarian_id integer, return_date date not null, checkout_date date not null, unique (sequence), foreign key (library_card_number) referen...

mysql - Updating the database using php -

i'm inserting addedworkhours database, problem if insert several times same id (afnumber), old , new values kept. new val doesn't replace old one. i'm trying update (the commented section) not @ successful. same result. i'm trying work using if/else condition, check whether value in column empty, insert. if not update, in if condition statement? the way i'm getting updates output: if(isset($_post['submit'])){ if(addedwh null) $addedhours = $_post['addedhours']; $selectaf = $_post['selectaf']; $sql1="insert `editedworkhours` (`afnumber`,`addedwh`) values('$selectaf','$addedhours')"; $getresult =mysql_query($sql1); if(mysql_affected_rows() > 0) { } else{ } else $tempname = $row['field']; $sql2 = "update editedworkhours set addedwh ='...

javascript - Jquery scroll to closest element with .class -

the problem i have html page, using search engine "ctrl+f" created me, integrated jquery plugin highlights me result searched for, , adds class ".highlight" elements highlights, thing want scroll between them , each time press search button. i tried didn't work: $(document).ready(function () { $("#btnsearch").on("click", function () { $('html, body').animate({ 'scrolltop': $(this).closest(".highlight").position().top }); }); }); maybe helps you... $(document).ready(function () { $("#btnsearch").on("click", function () { $('html, body').animate({ 'scrolltop': $(this).closest(".highlight").parent().scrolltop()+ $(this).closest(".highlight").offset().top - $(this).closest(".highlight").parent().offset().top, }); }); });

php - cakephp pagination with condition -

i defined condition variable values. need write formate how can write this. $this->paginator->settings = array('conditions' => array( if(!empty($this->request->data['filter']['delivery'])) { 'gig.delivery <=' => $this->request->data['filter']['delivery'], } if(!empty($this->request->data['filter']['delivering'])) { "gig.bangsalsodelivering in ({$csv_deliveringfilters})", } if(!empty($this->request->data['filter']['servicetype'])) { "gig.bangsservicetype in ({$csv_bangsservicetypesfilters})", } if(!empty($this->request->data['filter']['style'])) { "gig.bangsstyles in ({$csv_stylefilters})", } if(!empty($this->request->data['filter']['fileformate'])) { "gig.bangsfileformates in ({$csv_fileformatefilters})", ...

c# - Visual Studio 2015 - Change Light Bulb, Quick Action settings -

Image
i've started using visual studio 2015 today , light bulb or quick action setting. want change these settings though, how do that? specifically rule ide0003 trying remove this local properties or members. how configure rule or remove it? trying remove local properties or members. there setting under text editor | c# controls whether this used member access: control rule? (i don't have install hand exact name.)

javascript - Onclick enlarge image inside a popup/dialog window -

is possible make image appear larger in popup window? example of picture trying expand: http://i.stack.imgur.com/grp1g.jpgnter mean popup/dialog box:example: http://i.stack.imgur.com/3wkqw.jpg code have far is: <div id="graphsect" id = "pageone" data-role="main" class ="ui-content"> <a href ="#mypopup" data-rel="popup" data-position-to="window"> <img src ="res/images/capture.jpg"></a> <div data-role="popup" id="mypopup"> <a href="pageone" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right">close</a><img src ="res/images/capture.jpg" style="width:1200px;height:600px;" > </div> </div> but resemble...

python - Changing dictionary consisting 16k dicts to a Pandas Dataframe -

i'm working on data mining problem master thesis. i'm using python data analysis, have no experience pandas, needed convert data dataframe. in order survival regression python package called lifelines need create covariate matrix experiment_data dict containing on 16k of dicts twitter data kickstarter projects (see example dict below). 16041: {'goal': 1200, 'launch': 1353544772, 'days-before-deadline': 3, 'followers': 149, 'date-funded': 1355887690.9189188, 'id': 52687, 'tweet_ids': [280965208409796608, ... n], 'state': 1, 'deadline': 1356136772, 'retweets': 0, 'favorites': 0, 'duration': 31, 'timestamps': [1355876412.0], 'favourites': 0, 'runtime': 27, 'friends': 127, 'pledges': [0.0, 0.0625, 0.0625, ... n], 'statuses': 7460} if create pandas dataframe dict, i'll able create covariate matrix using patsy, example this: x =...

sftp - Error: Connection timed out after 20 seconds of inactivity? -

error: connection timed out after 20 seconds of inactivity? error: file transfer failed after transferring 6,094,848 bytes in 190 second open filezilla->edit->setting->timeout in seconds: - 20 ->change ->500.

jquery - why do we need prefix "data" for custom data attributes in html5 -

is there reason use data-attribute custom data attributes on html5 elements? remember using custom data attributes without using data prefix , think did work alright. can please correct me. abridged version of the answer @lachlan hunt duplicate question : it guarantees there not clashes extensions html in future editions. more convenient dom api accessing these attributes scripts. they provide clear indication of attributes custom attributes, , ones standardised attributes.

websphere portal - How to get registration data from a portlet/jsp -

where websphere portal 8.5 store user registration data entered through sign form? i.e. user id, password, first, last name, email etc. websphere portal doesn't store user info on own. it uses puma , vmm talk users store registry. see more here http://www-01.ibm.com/support/knowledgecenter/sshrkx_8.0.0/plan/plan_vmm_int.dita . guess can @ http://public.dhe.ibm.com/software/dw/websphere/puma_scenarios.pdf figure out how can retrieve user information user registry.

api - printing PayPal response -

i writing code response $paypalresult = $paypal->gettransactiondetails($paypalrequestdata); echo '<pre />'; print_r($paypalresult); after using print_r command getting following result. array ( [receiverbusiness] => rdaa.org [receiveremail] => rdudeja.org [receiverid] => rs2thgdskdkg6 [email] => begin@denim.com [payerid] => rpxdf4pdmrqd6 [payerstatus] => verified [countrycode] => [shiptoname] => kamal sudeja [protectioneligibility] => eligible [protectioneligibilitytype] => itemnotreceivedeligible,unauthorizedpaymenteligible [l_name0] => denim [l_number0] => 1234 [l_qty0] => 1 [l_taxamt0] => 0.00 [l_currencycode0] => usd [l_taxable0] => false [errors] => array ( ) [orderitems] => array ( [0] => array ( [l_name] => denim [l_desc] => [l_number] => 1234 [l_qty] => 1 [l_amt] => ...

oop - I can't Read from FileText C# -

i have make connection between students,classes, , year this: 1 year can have 1 or more classes , 1 class can have 1 or more students. i made generic list. problem have information 1 .txt file , don't know how it. my file this: (year,class,name,surname,average). 1 314 george andrew 8 2 324 popescu andrei 9 2 323 andreescu bogdan 10 3 332 marin darius 9 3 332 constantin roxana 10 code: public class student { public string name { get; set; } public string surname { get; set; } public int average { get; set; } } } public class grupa { public int name { get; set; } public list<student> setstudent { get; set; } public grupa() { setstudent = new list<student>(); } public void print() { //console.writeline("grupa: " + this.name); console.writeline("studentii din grupa: "); ...

javascript - OneDrive Saver Api (Multiple Files Upload) -

var myfiles = []; if (val == "address") { myfiles.push({ 'file': 'http://----/content/file/addresses.xlsx', 'filename': 'addresses.xlsx' }); } if (val == "debitdetail") { myfiles.push({ 'file': 'http://----/content/file/debitdetails.xlsx', 'filename': 'debitdetails.xlsx' }); } if (val == "addressassociated") { myfiles.push({ 'file': 'http://----/content/file/addressassociatedcompanies.xlsx', 'filename': 'addressassociatedcompanies.xlsx' }); } if (val == "debitdetailassociated") { myfiles.push({ 'file': 'http://----/content/file/debitdetailsassociatedcompanies.xlsx', 'filename': 'debitdetailsassociatedcompa...

closures - Completion Handlers in Swift -

i'm new @ swift development , trying handle on closures , completion handlers. have function following declaration inside struct called objectdata func getdata(id1:int, id2:int, completion: (dataobject? -> void)) i trying call function like objectdata.getdata(1, id2: 2){ (let myobject) in } but following error cannot invoke 'getdata' argument list of type '(nsnumber, id2: nsnumber, (_) -> _)' please can help for better readability, change header this. remember have declare types, not variable names: func getdata(id1:int, id2:int, completion: (objectdata?) -> (void)) now use syntax use closures: self.getdata(1, id2: 1) { (data) -> (void) in // code executed in closure } if want study further, can find full syntax of closures here (notice appropriate name of website). hope helps!

SQL Server Pivot Data -

can me out. how i'm storing records in 1 of tables in sql server. how can use pivot/unpivot represent data below table in expected format shown below. in advance. <p>table - scores</p> <table> <tbody> <tr> <td>name</td> <td>mode</td> <td>&nbsp;game</td> </tr> <tr> <td>player a</td> <td>&nbsp;easy</td> <td>&nbsp;game 1</td> </tr> <tr> <td>player a</td> <td>&nbsp;easy</td> <td>&nbsp;game 1</td> </tr> <tr> <td>player a</td> <td>&nbsp;easy</td> <td>&nbsp;game 2</td> </tr> <tr> <td>player b</td> <td>&nbsp;easy</td> <td>&nbsp;game 1</td> </tr> <tr> <td>player b</td> <td>&nbsp;medium</td> <td>&nbsp;game 1</...

How to install MariaDB alongside with MySQL on localhost? -

i learning mariadb. want install mariadb on localhost don't want uninstall mysql on system. have googled didn't information can install maria db keeping mysql is. can u please me? mariadb drop in place replacement mysql, can install alongside mysql. installing mariadb alongside mysql

c# - Email Settings API Auth2.0 Update Signature -

where going wrong here? when try url says: "required parameter missing: response_type". need add thing work? , if can provide simple explanation that'd awesome. string client_id = "xxxxxxx"; string client_secret = "xxxxxxxxxxx"; string scope = "https://apps-apis.google.com/a/feeds/emailsettings/2.0/workwearoutlet.co.uk/zak.baig/signature"; string redirect_uri = "urn:ietf:wg:oauth:2.0:oob"; // prepare oauth parameters oauth2parameters parameters = new oauth2parameters(); parameters.clientid = client_id; parameters.clientsecret = client_secret; parameters.scope = scope; parameters.redirecturi = redirect_uri; string applicationname = "signature"; string domain = "workwearoutlet.co.uk"; // request authorization user string authorizationurl = oauthutil.createoauth2authorizationurl(parameters); cons...

c - Why doesn't my atoi implementation work with negative numbers? -

#include<stdio.h> int ft_atoi(char *str) { int i; int sign; int val; int nbr; = 0; sign = 1; val = 0; nbr = 0; while(str[i] != '\0') { if (str[i] == '-') sign = -sign; i++; } = 0; while(str[i] >= '0' && str[i] <= '9' && str[i] != '\0') { nbr = (int) (str[i] - '0'); val = (val * 10) + nbr; i++; } i++; return (val * sign); } it returns 0 when try negative numbers. the second while loop breaks if str[0] '-' . while(str[i] != '\0') { if (str[i] == '-') sign = -sign; i++; } should be if (str[0] == '-') { sign = -1; str++; }

passive mode - FTP data connections reuse -

i working on ftp client kicks , trying understand workflow of data connections. as understand, initial ( command ) connection permanent until quit. however, unsure of data connection - re-initiated per-command? call port ... or pasv , second connection, list , results, connection closes, start over? also, need call pasv (or port ... ) again after each connection closes? seems when try test things out using passive connection, cannot re-connect same port after first command has returned results , closed data connection. can keep calling pasv -> data connect -> run command -> results -> data connection closed -> pasv , seems it's not how it's meant run? also, if has material on ftp more terse rfc appreciate it. you have open new connection every time. it's closing of connection, how (or server) can tell transfer completed (at least in common "stream mode"). you cannot reuse local/remote port number combination, when tcp connect...

javascript - Enable GPS programmatically -

i'm using javascript develop app. have problem. when start app check if gps or internet connection enabled. app shows alert say: "gps disable". there way create button "go setting" send user device settings? or can enable gps programmatically?

c# - Generate IP which lie in between start and end values of IPv6 -

i needed generate ip(s) lie in between given start , end ip in case of ipv6. for example start ip 2001:db8:85a3:42:1000:8a2e:370:7334 , end ip 2001:db8:85a3:42:1000:8a2e:370:7336. i need ip lie in between. regards you could: public static ienumerable<ipaddress> fromto(ipaddress from, ipaddress to) { if (from == null || == null) { throw new argumentnullexception(from == null ? "from" : "to"); } if (from.addressfamily != to.addressfamily) { throw new argumentexception("from/to"); } long scopeid; // scopeid can used ipv6 if (from.addressfamily == addressfamily.internetworkv6) { if (from.scopeid != to.scopeid) { throw new argumentexception("from/to"); } scopeid = from.scopeid; } else { scopeid = 0; } byte[] bytesfrom = from.getaddressbytes(); byte[] bytesto = to.getaddressbytes(); wh...