Posts

Showing posts from April, 2012

php - When page is loading ajax not response -

i have progress bar, t work when page not loading, if page loading example inserting data database progressbar not, work when finish inserting data, wring code ? <script> $(document).ready(function() { // setinterval(function() { $.get("currentprogress.php", { }, function(data) { $('#progress_bar').width(data +"%"); $('#progress_completed').html(parseint(data) +"%"); } )},1000); }); </script> in php loop: $_session['value'] +=1; and in currentprogress.php: <?php session_start(); echo $_session['value']; ?>

character encoding - meaing of maxlen in INFORMATION_SCHEMA CHARACTER_SETS Table of MySQL -

from mysql official website: http://dev.mysql.com/doc/refman/5.0/en/character-sets-table.html you see table definition. can here tell 'maxlen' mean? max length of bytes character encoding? thanks in advance! from documentation : the maxlen column shows maximum number of bytes required store 1 character.

Using unary representation with addition java string -

i need write code takes string input , turns it, or effect, valid unary equation addition verify if valid. i'm confused, point me in direction of understanding this? example be: 111+1111=11111+1+1 statement 3+4=5+1+1 valid. other question how use stacks unary operations. if limited language can write simple parser using number of methods. can first split string string[] parts = eqn.split("="); then split each part: string[] left = parts[0].split("\\+"); string[] right = parts[1].split("\\+"); now can count lengths of strings: int leftside = 0; (string l : left) { leftside += l.length; } and on right side , see if equal. there many other ways can tackle this. basically have write parser . might want use character-by-character scanner, or use regexes or generic tool such antlr. depends on final goal , whether change. have characters other 1, +, =, example? my guess homework. , guess expected read character-by-charact

css - Questions on using the 'rem' unit, advice needed -

happy friday everyone, i've got project allows me quite bit of freedom far trying new things , setting modern design standards @ corporate level. i've not spent time in past experimenting 'rems', think (mobile) project perfect time tinker around in real-world scenario. support low ie8, , know fonts fixed using this mixin , problem solved. what hear community's experience using 'rems' structure , positioning. wise use 'rems' everything? best used widths , heights? using margins , paddings? this more of fact-finding mission coming guys specific problem, please feel free reply and/or advice! thanks! :) if comfortable em, using rems should fine, long can live reduced browser support, or willing add fallbacks. i use rem everything, except in horizontal dimensions, might want use percentage values. i more or less map rem value pixels, setting root element’s (html) font-size 62.5% . 10px if user hasn’t changed browser default. rem ma

f# - Pipeline List with Constant Parameters -

i'm trying create pipeline consists of main parameter being list constant. as simple example type clocktype = | in | out let clockmap index offset = match index | index when index + offset % 2 = 0 -> in | _ -> out let mapit offset = [0 .. 23] |> list.map offset it works when take out offset . i've tried doing tuple doesn't int list . best way go this? i'm learning f# bear me. is you're after? type clocktype = in | out let clockmap offset index = if (index + offset) % 2 = 0 in else out let mapit offset = [0 .. 23] |> list.map (clockmap offset) output be: mapit 3 |> printfn "%a" // [out; in; out; in; out; in; out; in; out; in; out; in; out; in; out; in; out; // in; out; in; out; in; out; in] if so, there multiple issues: clockmap 's parameters backwards % has higher precedence + clockmap never being called (and offset needs partially applied clockmap ) the change match if purely rea

c# - Image gets broken when exporting a table to word doc in asp.net -

Image
i trying export data inside panel word doc in asp.net 4.0 i able achieve result of exporting whole content word, getting broken image box using in .aspx page. my .aspx page : <asp:panel id="tblreport" runat="server"> <div class="boxed1a"> <img class="images4" src="images/aoafund.png" width="640" height="45" /> <table class="tb3"> <tr> <td>leasehold & functional programs</td> <td><asp:textbox id="txtlfp" runat="server"></asp:textbox></td> </tr> <tr> <td>n/a</td> <td><asp:textbox id="txtna" runat="server"></asp:textbox></td> </tr> <tr> <

Math.factor(j) error when using data.table created from .xlsx import in R -

i using information base data.table pull data other data.tables in following example: test <- function() { library(data.table) test.dt <- data.table(id=c("abc","xyz","ijk"),type=c("1","1","0"),line.position=1:3) counts.dt <- data.table( abc=c(10,na,na,na),xyz=c(20,30,na,na),ijk=c(10,10,10,10),x2abc=na,x3abc=1:4) print(test.dt) print(counts.dt) test.dt[,count:=sum(!is.na(counts.dt[[id]])),by=id] test.dt[,count.value:=counts.dt[line.position,id,with=false],by=id] print(test.dt) } this works fine, , returns expected result: column pulls uses (line.position,id) row in test.dt grab values of counts(line.position,id). however, cannot repeat more complex example pulls data worksheet. error: error in math.factor(j) : abs not meaningful factors. error thrown right before last print statement. test2 <- function( file.directory="c:/users/csnyder/desktop/bo

android - How to change image size when pressing -

i'm developing android app , achieve effect haven't found answer to, after searching. the effect obtain on image. when press image, apply sort of tint on image in order show feedback, go little bit further, wouldn't apply tint sort os scale on image. e.g. have following image, normal image , , if press image (and while keep pressed), image shrink bit, pressed image n.b.- black part not part of image, part of background. image blue square. thank help! :) p.s.- couldn't post images here because don't have enough reputation. you need set ontouchlistener of imageview displays image, replaces displayed image. listener runs when press or unpress view (in case image). sample code: imageview iv = (imageview)findviewbyid(r.id.my_image_view); iv.setontouchlistener(new imageview.ontouchlistener() { @override public boolean ontouch(view v, motionevent e) { if (e.getaction()==motionevent.action_down) // write code here sets

Django model design: editable help text for individual model fields. Is there a foreign field that references a specific field of a model? -

i have several models several fields in app. want set way user able modify text system each field in model. can give me guidance on how design models, , field types use? don't feel right storing model , field name in charfields, if way, may stuck it. is there more elegant solution using django? for quick , silly example, app named jobs, 1 named fun, , make new app named helptext: jobs.models.py: class person(models.model): first_name = models.charfield(max_length=32) . . interests = models.textfield() def __unicode__(self): return self.name class job(models.model): name = models.charfield(max_length=128) person = models.foreignkey(person) address = models.textfield() duties = models.textfield() def __unicode__(self): return self.name fun.models.py: class rollercoaster(models.model): name = models.charfield(max_length=128) scare_factor = models.positiveinteger() def __unicode__(self): return

java - using mockito with IntelliJ -

i new java, , background in .net. trying use mockito in java project in intellij. trying follow simple example: http://code.google.com/p/mockito/ so, added library mockito-all-1.9.5.jar folder c:\{my app path}\web\app\web-inf\lib and added in intellij using project structure , libraries. and created test class , add following import static org.mockito.mockito.*; , getting error: "static imports not supported @ language level" under file - project structure - project , make sure have project language level set @ least 5.0. (i expect 6.0 or 7.0 now). static imports indeed supported since java 5. also, mockito used in tests, , has no reason part of deployed libraries of webapp. should not under web-inf/lib.

php - How to display 3 random values from MYSQL table -

how go displaying 3 random values each time page loaded? @ minute have displaying 1 @ time using following code: <?php $ssqlquery = "select careername careers order rand() limit 1"; $aresult = mysql_query($ssqlquery); $arow = mysql_fetch_array($aresult, mysql_assoc); $squoteoftheday = $arow['careername']; echo $squoteoftheday; ?> i have tried doing limit 5 had no effect on result. thanks you'll have call mysql_fetch_assoc() again every single record fetching. so, use limit 3 , loop through result set. this: $ssqlquery = "select careername careers order rand() limit 3"; $aresult = mysql_query($ssqlquery); while($arow = mysql_fetch_array($aresult, mysql_assoc)) { $squoteoftheday = $arow['careername']; echo $squoteoftheday; } refer manual page of mysql_fetch_assoc() . you'll find more examples there.

ruby on rails - authlogic "you did not provide any details for authentication" with email and password fields in form -

i above message when try login user created after logout... my user model this, name display name class user < activerecord::base attr_accessible :name, :email, :persistence_token, :password, :password_confirmation before_save { |user| user.email = email.downcase } validates :email, uniqueness: true acts_as_authentic |configuration| configuration.session_class = session end end my migration class createusers < activerecord::migration def self.up create_table :users |t| t.string :email t.string :name t.string :crypted_password t.string :password_salt t.string :persistence_token end end def self.down drop_table :sessions end end and use :email , :password fields login form you should set login_field parameter :email, because default :username or :login field: class user < activerecord::base #... acts_as_authentic |configuration| configuration.session_class = session confi

c++ - io_getevents returns less number of jobs than requested in time shorter than timout -

i reading ssd, requesting 20 async jobs. io_getevents returned value 7 indicating timed out. timeout set 10 seconds seen below. elapsed time of call 4.89e-05 seconds, eg, there still 10 seconds left. question: had incident that? if did have found solution? here part of code: struct timespec ts = { 10, 0 } ; /* ten seconds delay */ const long ec = io_getevents( ctx, num_jobs, num_jobs, &events[ 0 ], &ts ) ; when ec returned 7, ts.tv_sec = 10 , ts.tv_nsec = 0 linux kernel: linux vtl80-g-1j4-823-21 2.6.18-274.18.1.el5 #1 smp thu feb 9 12:20:03 est 2012 x86_64 x86_64 x86_64 gnu/linux your appreciated! btw. not able check post earlier in few hours. by putting steps, , debugging outputs figure out there problem aio driver on our linux ( 5.3 carthage, 2.6.18-128.el5 ) solution applied (i'm putting in in case runs in the same problem) this: (we count elapsed seconds call outselves.) 1) if see error returned io_getevents() report it. done. 2) if see

Is the DriverManager class a Singleton in Java? -

from this source read that: you may have experience working jdbc drivers. example, classloader attempts load , link driver class in "org.gjt.mm.mysql" package. if successful, static initializer called. class.forname("org.gjt.mm.mysql.driver"); connection con = drivermanager.getconnection(url,"mylogin", "mypassword"); let's see why need class.forname() load driver memory. jdbc drivers have static block registers drivermanager , drivermanager has static initializer only. the mysql jdbc driver has static initializer looks this: static { try { java.sql.drivermanager.registerdriver(new driver()); } catch (sqlexception e) { throw new runtimeexception("can't register driver!"); } } does mean drivermanager singleton class? it's not singleton. it's pure utility class, static methods. there 0 instance of class. singleton have 1 instance of class, ,

Passing a command line argument into a Python Script causes error -

i have python example script adafruit controls servo , works! i execute change servomin , servomax values calling 2 values command line. problem having seems not when import sys , set servomin = (sys.argv) . im not sure why not accepting int or str. ideas? here code body: #!/usr/bin/python adafruit_pwm_servo_driver import pwm import time import sys # =========================================================================== # example code # =========================================================================== # initialise pwm device using default address # bmp = pwm(0x40, debug=true) pwm = pwm(0x50, debug=true) servomin = 150 # min pulse length out of 4096 servomax = 600 # max pulse length out of 4096 def setservopulse(channel, pulse): pulselength = 1000000 # 1,000,000 per second pulselength /= 60 # 60 hz print "%d per period" % pulselength pulselength /= 4096 # 12 bits of resolution

sql server - Login SQL from another domain -

i trying connect sql server 2012 on separate domain visual studio/ computer. (it’s personal machine on workgroup). i have access server , can log in fine sql authentication want log on via windows authentication. when try following error: the login untrusted domain , cannot used windows authentication. this on data connection of visual studio- nothing code. how make domain trusted (without login via ad on machine) or around issue? i tried using control panel credential manager no luck. thank that setting on domain controller, not on computer. domain sql server in needs trust domain login in from. have workgroup computer, domain computer. talk domain admin see if can make happen.

java - Package jruby script as .jar with annotations -

is there way package jruby script .jar file support annotations? don't think warbler this. jruby2java looks supported annotations hasn't been updated in 4 years. the jruby compiler , part of core jruby features, has java_annotation method allows define annotations in jruby code. here example spring mvc annotations, annotations added on class greetingcontroller , , on print method: java_import 'org.springframework.stereotype.controller' java_import 'org.springframework.web.bind.annotation.requestmapping' java_import 'org.springframework.web.bind.annotation.requestmethod' java_import 'org.springframework.ui.modelmap' java_package 'com.weblogism.myapp' java_annotation 'controller' java_annotation 'requestmapping("/welcome")' class greetingcontroller java_annotation 'requestmapping' java_signature 'string print(modelmap model)' def print(model) model.add_attribute('

c# - CustomChrome issue with WindowStyle=None, restoring window -

here's context problem: i downloaded customchromelibrary , , changed shell reference microsoft.windows.shell system.windows.shell, same thing in framework 4.5. working customchromesample, able show customchrome window, if change following properties in mainwindow.xaml: windowstyle=none allowtransparency=true background=transparent (note windowstyle=none alone causes issue) then, if change windowstate in sequence: normal (init state) maximized (click button maximize) minimized (click button minimized) normal (click program icon in taskbar) then program icon disappears taskbar , ive no idea why. so, have idea? also, there place upload code see? alright, never mind. used mahapps.metrowindow , copy pasted theme change how wanted while keeping functionalities of normal window. code great.

c - Code is overwriting array -

is there problem these samples of code? whenever there x in spot still overwriting o in spot if win can made. apparently if not statement not working? 88 , 79 'x' , 'o' in ascii. while(i+j<6) { if (board[i][j]+board[i][j+1] == compxo*2) { if(board[i][j+2] != (88||79)) { board[i][j+2] = compxo; won=1; break; } } else i++; } if (board[i+1][j+1]+board[i+2][j+2] == compxo*2) { if(board[i][j] != (88||79)) { board[i][j] = compxo; won=1; } } you can't compare 2 different values @ once, expression 88||79 logical or, , evaluates 1 , appropriate way is: if(!(board[i][j] == 88 || board[i][j] == 79)) or if(board[i][j] != 88 && board[i][j] != 79)

java - convert ByteArrayInputStream image sequence into a video clip -

iam using udp connection ,i have android application send video pc runs java application. java application runs on pc recieve packets send android application bytearrayinputstream(imagedata) ,now need convert these images video clip how can that, following code java application pc code.. import java.io.bytearrayinputstream; import java.io.ioexception; import java.lang.runnable; import java.lang.thread; import java.net.datagrampacket; import java.net.datagramsocket; import java.net.inetaddress; public class cam_thread_udp implements runnable { int nb = 0; car_gui car_state; thread t; public static int header_size = 5; public static int datagram_max_size = 1450; public static int data_max_size = datagram_max_size - header_size; public cam_thread_udp(car_gui gui) { car_state = gui; try { t = new thread(this); t.start(); } catch (exception e){e.printstacktrace();} } public v

c++ - How to share pointer between threads in Open MP safely? -

i have dynamically allocated array of flags, can read , modified different threads in open mp, there safe way ensure threads within open mp can read up-to-date data in array? i tried barrier/flush/volatile, looks have problems, if beyond scope of open mp, multi-threading library can in windows os? tbb or cilk+?

javascript - Pass a function that returns the value of the ko.computed error during submit -

i'm having trouble submitting form knockout js. i receive error "pass function returns value of ko.computed." the code follows: (function(records,$,undefined){ records.models={ student:function(data){ var self=this; self.id=ko.observable(data.id); self.fname=ko.observable(data.fname); self.lname=ko.observable(data.lname); if(data.initial==='undefined'||data.initial===null){ self.initial=ko.observable(""); }else{ self.initial=ko.observable(data.initial); } self.fullname=ko.computed(function(){ return self.fname()+" "+" "+self.initial()+" "+self.lname(); }); }, students_model:function(){ var self=this; self.selectedstudent=ko.observable(); self.students=ko.observablearray([]);

html - CSS: Making nested min-height consistent -

for reason, nested elements min-height not inherit height of grandparent in browsers. <html style="height: 100%"> <body style="min-height: 100%"> <div style="min-height: 100%; background: #ccc"> <p>hello world</p> </div> </body> </html> i haven't bothered testing between different browser versions, in chrome 26 , opera 12.14, displays expect, gray background covering of screen hello world in top left corner. however, in ie 9 , firefox 20, gray background height of single line of text. testing further, adding: position: relative div changes nothing min-height: inherit on div changes nothing position: absolute changes width, height 100% in above browsers except ie 9, background covers text. position: fixed similar position: absolute , except ie 9 reverts original behaviour of 100% width. float: left similar position: absolute , except firefox 20 sh

javascript - How to mobilize all links with http://www.google.com/gwt/x?u=? -

i've trying make links on of pages "mobilized" great service google mobilizer: http://www.google.com/gwt/x?u= is there way prefix of links within div or element, rather link site.com/link becomes http://www.google.com/gwt/x?u=site.com/link ? i'm thinking might work: if (window.location == $link) window.location = "http://www.google.com/gwt/x?u=" + $link; i'm not sure how code it. if know how it's done thankful! i think useful you: download file mobile_detect.php @ github put on root of server put code @ beginning of every page redirect <?php include('mobile_detect.php'); $detect = new mobile_detect(); if ($detect->ismobile()) {header('location: http://www.google.com/gwt/x?u=http://' . $_server["http_host"] . $_server["request_uri"],php_url_path . '');} ?> i tested this site , works fine

php - How to preload a document and presenting it on screen only when the browser finish loading data from server -

is there way of presenting on screen @ same time when document, dom, images, ajax's calls, objects , other stuff finished loading? that instead of showing them "in-parts" browser gets information server. any solution useful. set display:none; until jquery ajax success() method fires, can set display properties normal. also, make sure ajax code inside of window.onload or $(window).on('load') handler. the downside of if ajax call unsuccessful, page not display, should define ajax error() method in jquery. edit: for showing images when done loading (put outside onload): $('img').each(function() { $(this).css('display','none'); $(this).on('load',function(){$(this).css('display','');}); }); also, want display type of loading symbol improve user experience.

php - Mysql returning only on row with group by query when multiple exist -

i have mysql table such id,row1,row2,row3 and have entries id | row1 | row2 | row3 ------------------------------- 1 | 10 | 5 | 10 2 | 20 | 5 | 10 and when run sql this select * `table` row3 = 10 group row2 it returns 1 row. want return both rows. any appreciated guys select * `table` row3 = 10 group row2 the group row2 tells take rows row2 's value same , display them (a summary entry). if want see rows, remove group command select * `table` row3 = 10

java - Sending data to sockets in an arraylist of Sockets -

i have made chat server clients can connect clients don't messages other sent. code all. sending , receiving , setting output streams. public void run() { while(true) { for(int = 0; < clientconnector.connections.size(); i++) { try { if(socket != null) { objectoutputstream output = new objectoutputstream(socket.getoutputstream()); objectinputstream input = new objectinputstream(socket.getinputstream()); whilechatting(input, output); } } catch (ioexception e) { e.printstacktrace(); } } } } public static void sendmessage(string message, string returnedmessage, objectoutputstream out) { try { system.out.println("[server] " + message); if(!message.isempty()) { out.writeobject("\247c[server

android - Cannot import views from xml sheet into MainActivity.java -

i've got bunch of views in xml sheet need manipulate in mainactivity.java file. here how trying in mainactivity.java file: import android.app.activity; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.checkbox; import android.widget.edittext; import android.widget.progressbar; public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } edittext txt_username = (edittext) findviewbyid(r.id.txtview_username); edittext txt_password = (edittext) findviewbyid(r.id.txtview_password); button btn_login = (button) findviewbyid(r.id.button_login); checkbox chkbox_remembermypassword = (checkbox) findviewbyid(r.id.checkbox_rememberpassword); checkbox chkbox_logmeinautomatically = (checkbox) findviewbyid(r.id.checkbox_logmeinautomatically); progressbar progressbar_login = (progressbar) findv

ParseException Java -

i writing appointment program allows user input appointment dates, description, , type of appointment. works correctly until make selection "print range" prints range of dates, when choose tells them enter start date , end date, program pulls of appointments between dates , displays them output box. here errors getting print range : appointmentnew.java:68: unreported exception java.text.parseexception; must caught or declared thrown date lowdate = sdf.parse(stdin.nextline()); ^ appointmentnew.java:70: unreported exception java.text.parseexception; must caught or declared thrown date highdate = sdf.parse(stdin.nextline()); ^ appointmentnew.java:77: unreported exception java.text.parseexception; must caught or declared thrown date newcurrentdate = sdf.parse(currentdate); i think should try/catch block not real sure of how that, , wondering if provide me answer or example fix

javascript - how to use @{Html.RenderPartial();} in razor view -

i using asp.net mvc razor views . loading tab content using iframe, tab.cshtml partial view gave tabbar.setcontenthref("a1","home/tab"); instead of want use partial page using @{html.renderpartial("tab");} if give tabbar.setcontenthref("a1","@{html.renderpartial("tab");}"); it showing error the partial view 'tab' not found or no view engine supports searched locations. can u tell me how

javascript - How do I force jQuery to "listen" for, and activate plugins on, future AngularJS ng-repeat elements? -

decently experienced jquery, new angularjs. i have page list of colors (variable number) attached jquery colorpickers (marked class ".colorpicker"). on static, php-generated version of page, works great; converting on ng-repeat, jquery doesn't catch future occurances. is there event can caught $.on(), or there other sneaky best-practices way accomplish angularjs? i've searched around, every answer i've found has been how set $.on('click') or similar. <ul class="unstyled"> <li ng-repeat="color in showcolors"> <input type="color" class="input-mini colorpicker" ng-model="color.hex"> {{color.category}} </li> </ul> anytime want manipulate dom or use jquery feature/plugin; it's time directive. add directive ng-repeat binds jquery colorpicker input field it's being added dom. like: <ul class="unstyled"> <li ng-repeat="colo

Sending int via socket from Java to C - strange results -

i have simple server written in java, sends integer connected client. have client written in c, connects server , prints out received integer. my problem result varies. half of times executing client correct result (234), other times 8323072. this server: class tcpserver { public static void main(string args[]) throws exception { serversocket welcomesocket = new serversocket(6789); while(true) { socket connectionsocket = welcomesocket.accept(); system.out.println("welcomesocket.accept() called"); datainputstream infromclient = new datainputstream(connectionsocket.getinputstream()); dataoutputstream outtoclient = new dataoutputstream(connectionsocket.getoutputstream()); outtoclient.writeint(234); } } } and client: int main(int argc, char *argv[]) { if(argc != 4){ printusage(); return; } char* serverip = argv[1]; char* serverportc = argv[2]; char* integertosend

find - Packet jpeg optimization in linux -

i have many jpeg images on server , added evry day. need optimize images. to optimize have use next command find . -iname "*.jpg" -exec jpegoptim -m85 --strip-all {} \; but find command finds images, not new! know, may specify -ctime , -mtime params, when jpegoptim optimizes image, image creation time changes now! therefore can not specify last mod time find command. i think, solution save processed files names in text file , when find command runs again exclude processed file. how can this? how add finded file name in text file, , how check file name in text file in next path? you use inotifywait inotify-tools (or other inotify frontend) continuously monitor folder contains jpegs , have them converted on fly, uploaded. $ inotifywait -mrq --format '%w%f' -e create . | while read file; [ "${file##*.}" = "jpg" ] || continue; [ -f "${file}" ] || continue; echo "jpegoptim -m85 --strip-all 

javascript - Re-style iframe content -

i've surfed around , haven't found satisfactory solution this. want display iframe on site , re-style content within it, not source page! have control on source page, don't have problem adding classes , ids elements needs be. i'm happy change using iframe using object or if that's easier, , i'm happy jquery or javascript. can't use ssis because needs work when not published.

java - exec command is not working in php script -

i have java file , generate itunes report. want execute within php script. im using exec() function in php:it working in linux.but not in windows.am missing anything?any appreciated. exec("java autoingestion ".'username'." '".'password'."' ".'vendorid'." ".'report_type'." ".'date_type'." ".'report_sub_type'." ".'2012-05-28'."",$output,$return); check result of string concatenation. looks little iffy: "java autoingestion username 'password' vendorid report_type date_type report_sub_type 2012-05-28" you not using variables, or else, there no reason concatenate stuff. even if capitalized parts placeholders not have concatenate. use variable interpolation: $username = 'username'; $password = 'password'; $exec = "java autoingestion '{$username}', '{$password}', ...&qu

How to use session in wordpress in plugin development -

i new write plugin ..i having testplugin.php file , ajax.php file .. my code in testplugin.php global $session; print_r($abc); //$abc array of data .. $session['arrayimg']=$abc; //saving data in session echo $session['arrayimg']; //displayin "array" and ajax.php consists of following code global $session; $abc = $session['arrayimg']; print_r ("abs== ".$abc); //displayin "abs== array" and if use session_start(); i following error warning: session_start() [function.session-start]: cannot send session cache limiter - headers sent i want send array of data 1 file of plugin file ... // on plugin or themes functions.php function register_session(){ if( !session_id() ) session_start(); } add_action('init','register_session'); // set session data - $_session['arrayimg'] = $abc; // data on ajax hooked function - function resolve_the_ajax_request(){ if( !s

Apache: Changing path to httpd.conf -

a few months ago installed apache on mac osx 10.6.8. apache automatically installed @ /usr/local/apache2. after hiccups got apache listen on port 8080, , able apache execute cgi scripts out of /usr/local/apache2/cgi-bin. i haven't used apache since then, , when fired apache using: /usr/local/apache2/bin$ sudo apachectl -k start and entered following url in browser: http://localhost:8080 apache wouldn't serve index.html page or other page in /usr/local/apache2/htdocs. however, if used url: http://localhost then apache did serve "an index.html" page displayed, "it works". checked httpd.conf file located @ /usr/local/apache2/conf/httpd.conf, , apache set listen on port 8080: listen 8080 next, changed file /usr/local/apache2/htdocs/index.html display, "hello world", apache still served page said "it works" when used url: http://localhost i checked httpd.conf file again line: documentroot "/usr/local/apache

Signing into drupal website remotly using C#.net and json -

i want create form in c#.net can sign me in through drupal website. service 3.x module enabled , rest server running on website correctly. problem how serialize username , password json format? finally solution : i've got windows form , contains textbox , masked-textbox , button (called button3 below) , on button click event , textbox , maskedtextbox contents placed in user object constructed using class : class user { public string username; public string password; public string name; public string number; public string address; public string email; public user(string user, string pass, string name = "", string number = "", string address = "", string email = "") { this.username = user; this.password = pass; this.name = name; this.number = number; this.address = address; this.email = email; } } then converted object json model using jso

mysql - Select all rows from two tabels -

i new database design , working on school project. have 3 tables ( users , roles , user_roles ). have created users , roles available users. have created user_roles table contains users , roles have been assigned them. i need query give me users, roles available , if allocated users. aim list available users , available roles can assign or remove rights access. how achieve this? the following schema of tables users ( `user_id` int unsigned not null auto_increment , `username` varchar(45) null , `password` varchar(45) null , `first_name` varchar(45) null , `last_name` varchar(45) null , `status` varchar(45) not null default 'active' , `date_from` date null , `date_to` date null , `created_by` varchar(45) not null default 'sysadmin' , `create_date` timestamp not null default now() , primary key (`user_id`) roles tables `role_id` int unsigned not null auto_increment , `role_name` varchar(45) not null , `date_from` datetime null defa

c# - Using the iphlpapi.dll in .Net to Add new IP Addresses on x64 machines -

Image
i using code add ip addresses nic card: [dllimport("iphlpapi.dll", setlasterror = true)] private static extern uint32 addipaddress(uint32 address, uint32 ipmask, int ifindex, out intptr ntecontext, out intptr nteinstance); public static uint32 addipaddresstointerface(string ipaddress, string subnetmask, int ifindex) { var ipadd = system.net.ipaddress.parse(ipaddress); var subnet = system.net.ipaddress.parse(subnetmask); unsafe { var ntecontext = 0; var nteinstance = 0; intptr ptrntecontext; var ptrnteinstance = new intptr(nteinstance); return addipaddress((uint)bitconverter.toint32(ipadd.getaddressbytes(), 0), (uint)bitconverter.toint32(subnet.getaddressbytes(), 0), ifindex, out ptrntecontext, out ptrnteinstance); } } it

cakephp - Check the expire date of every rows -

i'll try explain problem: i have 1 model attorney have many rows. every attorney have date expire in date coloumn. ex: 15/09/2013 i need check, every day, if attorney expire in 30 days. in other words, need check, every day, date of every attorney registered , if date of expire less 30 days, , grab id of attorney in situation , execute action. i have nothing. how this? you need use cron job execute these task every day. to check if record expire in 30 days, use php strtotime calc final date. then, should compare if expire date lower or equals: date('y-m-d', strtotime( date('y-m-d') . ' +30 day' ));

jquery - Expand this code to check if HTML comment in head includes a string -

the <head> contains: <!-- foo 1.2.3 author bill --> <!-- foo 1.2.3 author joe --> i can far code may wrong: var hc = $('head')[0].childnodes; (var = 0; < hc.length; i++) { console.log(hc); if (hc[i].nodetype == 8) { // comments have nodetype of 8 // need here value , verify 1 of comments includes "bill" } } my own take on problem create simple function, coupled use of contents() retrieve child-nodes of given element. function: function verifycomment(el, tofind) { return el.nodetype === 8 && el.nodevalue && el. nodevalue.indexof(tofind) > -1; } and use (note i've used element other head , js fiddle doesn't really/easily offer access head element of document, changing selector should make work head well): $('#fakehead').contents().each(function(){ console.log(verifycomment(this, 'bill')); }); js fiddle demo . as alternative could, of course, extend prototy

powershell - Select-Object with output from 2 cmdlets -

suppose have following powershell script: get-wmiobject -class win32_service | select displayname,@{name="pid";expression={$_.processid}} | get-process | select name,cpu this will: line 1: services on local machine line 2: create new object displayname , pid. line 3: call get-process information each of services. line 4: create new object process name , cpu usage. however, in line 4 want have displayname obtained in line 2 - possible? one way output custom object after collecting properties want. example: get-wmiobject -class win32_service | foreach-object { $displayname = $_.displayname $processid = $_.processid $process = get-process -id $processid new-object psobject -property @{ "displayname" = $displayname "name" = $process.name "cpu" = $process.cpu } }

Unable to send message to SignalR client in Azure after redeploy -

i have made few simple modifications mvc-chat sample application , have deployed azure running on 2 webworker-instances. clients can talk other clients on same instance, solved using backplane later. when deploy new code server (from visual studio), instances upgraded 1 one, , clients reconnected first instance 2 (while instance 1 gets new code), , clients reconnected instance 1 while instance 2 upgraded. (i not changing code, re-deploying). the problem is: after clients have reconnected, of them not able receive messages sent them, receive broadcasts. here hub code: public class chathub : hub { private string getroleid() { return roleenvironment.currentroleinstance.id; } public override task onconnected() { string message = string.format("onconnected ({0}) {1} - version: {2}", getroleid(), context.connectionid, system.reflection.assembly.getexecutingassembly().getname().version); clients.all.newmessage(message);

mysql - Cannot start phpMyAdmin with Amazon RDS -

i have started ec2 instance in amazon , mysql rds. trying install phpmyadmin without success.. have downloaded , extracted files of phpmyadmin /var/www/html/phpmyadmin , changed config.inc.php to: $cfg['servers'][$i]['host'] = '[mydb].[randomstring].us-east-1.rds.amazonaws.com'; $cfg['servers'][$i]['port'] = '3306'; $cfg['servers'][$i]['socket'] = ''; $cfg['servers'][$i]['connect_type'] = 'tcp'; $cfg['servers'][$i]['extension'] = 'mysql'; $cfg['servers'][$i]['compress'] = true; $cfg['servers'][$i]['auth_type'] = 'config'; $cfg['servers'][$i]['user'] = '?????'; $cfg['servers'][$i]['password'] = '??????'; and when try enter: phpmyadmin folder following error: "the mbstring extension missing. please check php configuration." for amazon add before co

Python 2.7: Wrong while loop, need an advice -

i have small problem while loop in python 2.7. i have defined procedure, print_multiplication_table , takes input positive whole number, , prints out multiplication, table showing whole number multiplications , including input number. here print_multiplication_table function: def print_multiplication_table(n): count = 1 count2 = 1 result = count * count2 print 'new number: ' + str(n) while count != n , count2 != n: result = count * count2 print str(count) + " * " + str(count2) + " = " + str(result) if count2 == n: count += 1 count2 = 1 else: count2 += 1 here expecting output: >>>print_multiplication_table(2) new number: 2 1 * 1 = 1 1 * 2 = 2 2 * 1 = 2 2 * 2 = 4 >>>print_multiplication_table(3) new number: 3 1 * 1 = 1 1 * 2 = 2 1 * 3 = 3 2 * 1 = 2 2 * 2 = 4 2 * 3 = 6 3 * 1 = 3 3 * 2 = 6 3 * 3 = 9 everything works fine until add while

r - Per-group operation on multiple columns on data.frame -

general problem have often: want perform operation on data.frame, each factor level produce 1 number, , uses information multiple columns. how write in r? i considered these functions: tapply - doesn't operate on multiple columns aggregate - function given columns separately ave - result has same number of rows input, not number of factors' levels by - hottest candidate, i hate format returned - list. want data.frame result, know can convert ugly, prefer solution! the op asking general answer, think 'plyr' package appropriate. 'plyr' package has limitations when approaching large data sets, everyday use (implied in original post), 'plyr' functions wonderful assets r user. setup : here quick data sample work with. data <- data.frame(id=1:50, group=sample(letters[1:3], 50, rep=true), x_value=sample(1:500, 50), y_value=sample(2:5, 50, rep=true)*100) how use plyr : i'm going address basic uses here example things started.

angularjs - Angular.js configuring ui-router child-states from multiple modules -

i'd implement setup can define "root state" in main module, , add child states in other modules. this, because need root state resolve before can go child state. apparently, should possible according faq: how to: configure ui-router multiple modules for me doesn't work: error uncaught error: no such state 'app' ngboilerplate.foo here have: app.js angular.module( 'ngboilerplate', [ 'templates-app', 'templates-common', 'ui.state', 'ui.route', 'ui.bootstrap', 'ngboilerplate.library' ]) .config( function myappconfig ( $stateprovider, $urlrouterprovider ) { $stateprovider .state('app', { views:{ "main":{ controller:"appctrl" } }, resolve:{ auth:function(auth){ return new auth(); } } });

javascript - 'onStateChange' event isn't triggered on page using flash player but is on a page using the HTML5 player -

adding event listener player on youtube video page this... document.getelementbyid("movie_player").addeventlistener("onstatechange", function() { console.log("state has changed"); }); ...works fine when run in console on video page using html5 player (console output: undefined ), when used on page flash player (console output: null ), event never triggered when state changed (i.e. when video paused or played). for example, running above line of code in console on this page works great. 'state has changed' message appears every time video played or paused. however, doing same on this page result in nothing happening @ all. does know why might case? sidenote: opted youtube html5 video player (youtube.com/html5)