Posts

Showing posts from June, 2013

ajax - Parsing a JSON file using Javascript/JQUery -

i have json file: { "guest": { "permissions": { "webportal": [ "access", "modify" ], {…} "test/dashboard": [ "access" ] }, "users": [ "guest" ], "time_out": "3600000" }, "administrator": { "permissions": { "webportal": [ "monitoring", "access", "modify" ], {…} "test/settings": [ "access", "modify" ] }, "users": [ "admin" ], "time_out": "3600000" } } what need take first items , drop them select box. instance: guest, administrator , under "users" section, 'n' number of entries, needs put select

php - Model/library lazy load in CodeIgniter -

i have in codeigniter: $this->load->model('test_model'); $this->test_model->.... i want just: $this->test_model->... i don't wanna autoload models, want load model on demand. how can add "lazy load" logic ci_controller ? __get() ? logic should add? thanks in advance! ps please don't confuse question codeigniter lazy-loading libraries/models/etc - have different targets. current solution update ci_controller::__construct() (path system/core/controller/ ) like foreach (is_loaded() $var => $class) { $this->$var = ''; $this->$var =& load_class($class); } $this->load = ''; $this->load =& load_class('loader', 'core'); then add new method ci_controller class public function &__get($name) { //code here @twisted1919's answer } the below seems not work in ci(matter fact, magic methods won't work), i'll leave here refrence though

swing - How to avoid making EDT sleep when calling a method that has Thread.sleep -

so, i'm trying make jlabel's text text typing out. problem i'm not sure how make sure edt doesn't sleep , gui still updates here code. startgametext() gets called somewhere else in program. (questions jlabel.) public void startgametext() throws interruptedexception { swingutilities.invokelater(new runnable() { public void run() { w.questions.sethorizontalalignment(swingconstants.center); w.questions.setfont(new font("helveltica", font.bold, 30)); typeoutquestions("...."); string awoken = "you have awoken in strange place. "; typeoutquestions(awoken); string remember = "you remember few things.."; typeoutquestions(remember); } }); } this method want call update label questions. public void typeoutquestions(string s) throws interruptedexception{ for(int = 0; <= s.length(); ++){ int p = 0; w.questions.sethorizontalalignment(s

android - Application icon background at google play store is not transparent -

Image
i have set new app icon on google play store , white parts of app doesnt get color of background in other appliction apps. i post here images show mean: thank helping. make transparent 1 using photo editor , save png. jpg can't handle transparency , saves file white areas.

xml - Unique Particle Attribution Error with <any>, <element>, and <choice> -

goal: element octave can have either subnode query or any subnode in namespace http://www.website.com/main . i don't know where/how violating unique particle attribution...there's no other element called octave or subnode called query. query not global element, used octave. error: "cos-nonambig: " http://www.website.com/main ":query , wc[" http://www.website.com/main "] (or elements substitution group) violate "unique particle attribution". during validation against schema, ambiguity created 2 particles." schema: <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns="http://www.website.com/main" xmlns:xs="http://www.w3.org/2001/xmlschema" targetnamespace="http://www.website.com/main" attributeformdefault="unqualified" elementformdefault="qualified" > <xs:complextype name="octave" > <xs:

Changing QIcon size in QStandardItemModel -

i trying make qtableview/qstandarditemmodel arbitrary sized qicons. in mwe below, have changed height of row using delegate. can't figure out how make use larger icon size in larger row. appreciated. note rows can same height long can set height. example, how make icons 50x50 in example below. #include <qtgui> #include "test.h" ////////////////////////////////////////////////////////////////////////// // test.h file: //#include <qtgui> // //class mainwindow : public qmainwindow { // q_object // // public: // mainwindow(qwidget *parent = 0); //}; class itemdelegate : public qitemdelegate { public: itemdelegate() {} qsize sizehint ( const qstyleoptionviewitem &, const qmodelindex & ) const { return qsize(50,50); } }; mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent) { qimage iconimage(100, 100, qimage::format_rgb32); iconimage.fill(0xf08080); const int array_height = 2; const int array_width = 2; qstandar

java - GridBagLayout align textField? -

Image
i want shorten text field doesn't stretch to end of jframe how looks now: how control width of textfield does't streatch tried setpreferedsize() , setsize() yet didn't work?? @override public void run() { jframe frame = new jframe("test calculator"); frame.setvisible(true); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setlocationrelativeto(null); frame.setsize(500, 500); jpanel panel = new jpanel(new gridbaglayout()); frame.getcontentpane().add(panel, borderlayout.north); gridbagconstraints c = new gridbagconstraints(); jlabel testlabel = new jlabel("enter score test 1: "); c.gridx = 0; c.gridy = 0; c.anchor = gridbagconstraints.west; c.fill = gridbagconstraints.both; c.insets = new insets(40, 15, 15, 0); panel.add(testlabel , c);

mysql - How to know which devices are connected to my network (using C#)? -

what i'm trying insert data on mysql database (like mac address) when user connects wireless network. in order this, i've been doing tests iphone , "arp -a" cmd , noticed result table doesn't refresh until ping iphone's ip address. example, connect iphone wireless network , can see iphone ip instantly on result "arp -a", when disconnect network iphone ip still showing on result. can avoid this? have ping huge range of ip numbers if want many mobile devices? any apreciated. if trying insert sql table on connection , have dd-wrt/open-wrt router write simple script on router submit sql query on client connection or disconnect. if not have dd-wrt/open-wrt capable router becomes more difficult. arp way of detecting connections not detect disconnects. run periodic ping against of known connected devices determine disconnects. either way, can't directly in c#.

node.js - NodeJS + async: which control flow option to chose? -

as know, async.parallel, defined such code: async.parallel([ function (callback) { callback(err, objects); }, function (callback) { callback(err, status); }, function (callback) { callback(err, status); }, ], function (err, results) { //smth results[n] array... }); performs tasks parallel. however, need callback result of first function ( objects , exact) avialable in 2nd , 3rd functions. in other words, first step – 1st function, second – ( 2rd + 3rd parallel results of 1st one). async.waterfall seems bad idea 'cause: in waterfall function can't work parallel i can't access every result of stack, last. any ideas? thanks! you need both waterfall , parallel . function thing1(callback) {...callback(null, thing1result);} function thing2a(thing1result, callback) {...} function thing2b(thing1result, callback) {...} function thing2(thing1result, callback) { async.parallel([ async.apply(thing

objective c - Deallocating object doesn't work -

maybe i'm working long have problem... let's make abstract, real names not important. i've 20+ classes inheriting superclass, car @interface car : nsobject; @interface volvo : car; @interface bmw : car; etc... in game class i've property volvo, bmw @property (nonatomic, strong) volvo *volvo; @property (nonatomic, strong) bmw *bmw; @property (nonatomic, strong) car *activecar; i create object dynamicaly , storing activecar in property activecar _bmw = [[bmw alloc] init]; _activecar = _bmw; now in restart method want able nil active car, it's not wokring though in log see both pointing on same address: _activecar = nil; // dealloc on bmw , car not called // _bmw = nil; // dealloc called on bmw , car class how can manage that? solution? if ([_activegame iskindofclass:[bmw class]]) _bmw = nil; if want destroy bmw when destroy activecar, there's no sense in keeping bmw around ivar anyway. _activecar = [[bmw alloc] init]; your

sas - Why does using CALL EXECUTE to run a macro error when running it directly works? -

i inherited sas program looks this: %macro complicatedstuff( groupid= ); %let fileid = %sysfunc( open( work.bigdataset ) ); %put 'doing difficult ' &groupid.; %let closerc = %sysfunc( close( &fileid. ) ); %mend complicatedstuff; %complicatedstuff(groupid=abc1); %complicatedstuff(groupid=def2); %complicatedstuff(groupid=3ghi); %complicatedstuff(groupid=j4ki); being multi-faceted programmer, looked @ , thought "surely can make least little bit more dynamic". sure enough, able develop thought simple solution using call execute : data work.ids; input id $4. ; datalines; abc1 def2 3ghi j4ki run; data work.commanddebug; set work.ids; command = cats( '%complicatedstuff(groupid=', id, ');' ); call execute( command ); run; i happy solution until came time ftp files generated complicatedstuff different server. our sas server running on unix , sas admins

Cannot package Sencha applicaiton for android native build on windows machine -

hi new sencha touch development. trying run sencha app package run config.json to package application android native build either run on android emulator or deploy on android device. facing following problem. following scenarios have tried no success setting android emulator in config file , running active emulator running. get following error. c:\project incubator\sencha-touch-2.1.1-gpl\myapp>sencha app package run config.json sencha cmd v3.1.2.342 [err] error: project folder 'c:\project incubator\sencha-touch-2.1.1-gpl\build' not empty. please consider using 'android.bat update' instead. created directory c:\project incubator\sencha-touch-2.1.1-gpl\build\src\org\amx\myapp added file c:\project incubator\sencha-touch-2.1.1-gpl\build\src\org\amx\myapp\stactivity.java created directory c:\project incubator\sencha-touch-2.1.1-gpl\build\res created directory c:\project incubator\sencha-touch-2.1.1-gpl\build\bin created directory c:\project incuba

Rails initializers only running in certain context (eg. server and not rake, generator, etc.) -

i'm in process of writing rails engine requires setup config , check see if required attributes defined on model. engine class in lib defines follows. module kiosk mattr_accessor :kiosk_class @@kiosk_class = 'computer' mattr_accessor :kiosk_primary_key @@kiosk_primary_key = 'id' mattr_accessor :kiosk_type_foreign_key @@kiosk_type_foreign_key = 'kiosk_type_id' mattr_accessor :kiosk_name_attribute @@kiosk_name_attribute = 'name' mattr_accessor :kiosk_ip_address_attribute @@kiosk_ip_address_attribute = 'ip_address' mattr_accessor :kiosk_mac_address_attribute @@kiosk_mac_address_attribute = 'mac_address' # private config , methods def self.setup if block_given? yield self end check_fields! end def self.required_fields [@@kiosk_primary_key, @@kiosk_name_attribute, @@kiosk_ip_address_attribute, @@kiosk_mac_address_attribute, @@kiosk_type_foreign_key] end def self.che

Secure image upload in php -

i making image upload function can re-use in code, has 100% secure. please tell me if can spot , security wholes in initial code; function upload($file) { list($width,$height,$type,$attr) = getimagesize($file); $mime = image_type_to_mime_type($type); if(($mime != "image/jpeg") && ($mime != "image/pjpeg") && ($mime != "image/png")) { return 'error3: upload file type un-recognized. .jpg or .png images allowed'; }else{ $newname = md5('sillysalt'.time()); if (move_uploaded_file($file, 'images/'.$newname.$type)) { return 'uploaded!'; }else{ return 'server error!'; } } } thanks! update; how far i've gotten , research, please tell me think. don't mind speed, me it's being 100% secure, or close to. function upload($file) { list($width,$height,$type,$attr) = getimagesize($file); $

mysql - How can I SELECT rows from a table when I MAX(ColA) and GROUP BY ColB -

i found this question similar i'm still having troubles. so start table named scores id | player | time | scorea | scoreb | ~~~|~~~~~~~~|~~~~~~|~~~~~~~~|~~~~~~~~| 1 | john | 10 | 70 | 80 | 2 | bob | 22 | 75 | 85 | 3 | john | 52 | 55 | 75 | 4 | ted | 39 | 60 | 90 | 5 | john | 35 | 90 | 90 | 6 | bob | 27 | 65 | 85 | 7 | john | 33 | 60 | 80 | i select best average score each player along information record. clarify, best average score highest value (scorea + scoreb)/2. the results this id | player | time | scorea | scoreb | avg_score | ~~~|~~~~~~~~|~~~~~~|~~~~~~~~|~~~~~~~~|~~~~~~~~~~~| 5 | john | 35 | 90 | 90 | 90 | 2 | bob | 22 | 75 | 85 | 80 | 4 | ted | 39 | 60 | 90 | 75 | based on question linked above, tried query this, select s.*, avg_score scores s inner join ( select max((scorea + scoreb

Find on models with HasAndBelongsToMany relationship returns unexpected format in Cakephp -

i'm working on tagging system in cakephp. tags can children of other tags roots. (no children of children). the models user , tag. relationships this: //user.php: public $hasandbelongstomany = array( 'tag' => array( 'classname' => 'tag', 'jointable' => 'users_tags', 'foreignkey' => 'user_id', 'associationforeignkey' => 'tag_id', 'unique' => true, ), ); //tag.php: var $belongsto = array( 'parent' => array( 'classname' => 'tag', 'foreignkey' => 'parent_id', 'dependent' => true, ), ); when try simple paginate, so, $this->user->recursive = 2; $this->set('users', $this->paginate()); i weird results this: array( (int) 0 => array( 'user' => a

jquery - Check link variable with JavaScript -

take example, page follows: http://www.example.com/page.asp?page=about with javascript, how can check if window's location contains ?page=about ? this code have far, can't seem work. $(document).ready(function(){ if ($(window.location:contains('?page=about')").length !== 0) { alert("currently on page"); } else { } }); please :) thanks use .indexof() instead of contains if ( window.location.href.indexof('?page=about') > -1) window.location contains location object .. href attribute holds url check fiddle

How to create a user and save it the DB in rails using backbone.js -

how create model/user , save db in rails using backbone.js [backbone] define user model: var user = backbone.model.extend({ defaults:{ birthday: "unknown" }, url: "/users", //create user restful service url validate: function(attrs,options){ if(attrs.name===''){ //simple checking return "name can't blank"; } } }); //define save callback function onsuccess(model, response, options){ console.log(response); } function onerror(model, xhr, options){ console.log("error"); } //create user instance var user = new user(); //validation user.on("invalid",function(model,error){ alert(error); }); //save data backend user.save({name:"jimmy",age:"12",gender:"male"},{success:onsuccess,error:onerror}); by default, backbone using jquery.ajax make restful json request. if want use other method, have override backbone.s

html - jQuery image sliding up instead of sliding right -

basically code making image slide when want slide right. what's wrong it? html <div id="wrapper"> <div id="header"> </div> </div> js var scrollspeed = 70; // speed in milliseconds var step = 1; // how many pixels move per step var current = 0; // current pixel row var imageheight = 4300; // background image height var headerheight = 300; // how tall header is. //the pixel row start new loop var restartposition = -(imageheight - headerheight); function scrollbg(){ //go next pixel row. current -= step; //if @ end of image, go top. if (current == restartposition){ current = 0; } //set css of header. $('#header').css("background-position","0 "+current+"px"); } //calls scrolling function repeatedly var init = setinterval("scrollbg()", scrollspeed); here code: http://pastebin.com/9fpvsbxm you need increment value

javascript - Remove Item from Array in Meteor.js -

i have collection called rulesets - each ruleset has array of "rules". have following html displays each ruleset , each rule: <template name="rulesets"> {{#each rulesets}} {{>rulesetsingle}} {{/each}} </template> <template name="rulesetsingle"> {{#each rules}} <p class="rule-description">{{this}} <a href="#" class="rule-delete-btn">x</a> </p> {{/each}} </template> i want able remove rule when user clicks "rule-delete-btn". have following javascript this: template.rulesetsingle.event({ 'click .rule-delete-btn': function(e){ e.preventdefault(); var array = rulesets.rules; var index = array.indexof(this); array.splice(index, 1); } }); the delete isn't working because "array" declaration isn't pulling valid array. how can find , store arr

dynamic - Getting a dynamically typed ServiceStack.redis client in C# -

i new c# whole , wondering how achieve functionality described below. not compiling @ indicated lines. code is: iterate through each kvp, query db using keystring table name return list var dbcon = dbconnectionfactory.opendbconnection(); dictionary<string, type> ibetdic = getfromsomewhere(); foreach (keyvaluepair<string, type> entry in ibetdic) { type type = entry.value; var typedredisclient = redis.gettypedclient<type>();/*not compiling here*/ string sql = "use ibet select * " + entry.key; var itemlist = dbcon.sqllist<type>(sql);/*not compiling here*/ foreach (var tablerow in itemlist ) { //store redistypedclient } } closest thing answer have found means have pass in type rather able access through dictionary wanting above: public void getandstoreintkey<t>(string tablename) t : ihasid<int> { var dbcon = dbconnectionfactory.op

php - Check if any of values exists in array -

want shorten code if( (in_array('2', $values)) or (in_array('5', $values)) or (in_array('6', $values)) or (in_array('8', $values)) ){ echo 'contains 2 or 5 or 6 or 8'; } tried (in_array(array('2', '5', '6', '8'), $values, true)) but understand true if values exists in array please, advice try array_intersect() , eg if (count(array_intersect($values, array('2', '5', '6', '8'))) > 0) { echo 'contains 2 or 5 or 6 or 8'; } example here - http://codepad.viper-7.com/gfilgx

primefaces - Strange behaviour of ArrayList in jsf -

i'm developing web app using jsf. trying display property "brandname" of element index 0 in arraylist "materialssummarybean.electrolysermateriallotlist" , property elements using "c:foreach". <br/> #{materialssummarybean.electrolysermateriallotlist.get(0).material.material.brandname} <br/> #{materialssummarybean.electrolysermateriallotlist.get(0).material.material.brandname} <br/> #{materialssummarybean.electrolysermateriallotlist.get(0).material.material.brandname} <br/> #{materialssummarybean.electrolysermateriallotlist.get(0).material.material.brandname} <br/> #{materialssummarybean.electrolysermateriallotlist.get(0).material.material.brandname} <br/> #{materialssummarybean.electrolysermateriallotlist.get(0).material.material.brandname} <br/>

java - how to send request get method in play framework -

how send request method in play? have play framework application, , java desktop application. want send request java desktop play framework method get. here's routes file play framework # routes # file defines application routes (higher priority routes first) # ~~~~ # home page / application.index post /auth application.authenticator post /datacompany application.getdatacompany post /listdatafile application.getlistfile post /urlfile application.geturlfile /getfile/{id} application.getfile # ignore favicon requests /favicon.ico 404 # map static resources /app/public folder /public path /public/ staticdir:public # catch */{controller}/{action} {controller}.{action} here's method in application controller play

Custom drag image with NSTableView as drag source -

is necessary subclass nstableview or nstablecellview create custom drag image when tableview drag source? if not, magic method missing this? cannot seem find solid. nstablecellview subclasses have can (slightly mysteriously) override: @property(retain, readonly) nsarray *draggingimagecomponents (array of nsdraggingimagecomponent instances composited (who knows in fashion composited...)) nstableview has - (nsimage *)dragimageforrowswithindexes:(nsindexset *)dragrows tablecolumns:(nsarray *)tablecolumns event:(nsevent *)dragevent offset:(nspointpointer)dragimageoffset but these indeed subclassing options seems. anybody know technique here? (10.8+ target ) it looks if nstableviewcell @property(retain, readonly) nsarray *draggingimagecomponents does not called automatically must explicitly referenced view based table views. -draggingimagecomponents can overridden supply components used composite drag image. - (void)tableview:(nstableview *)tableview dr

printf - php - using sprintf to add "+" sign removes decimals from formatted number -

i want show changes in stock index: 12 => +12.00 150.5 => +150.50 -30.2 => -30.20 -2.85193 => -2.85 i've got this: sprintf("%+d", number_format(floatval($key), 2, '.', ',')) but it's stripping decimals formatted number , returning things +45 . is there efficient way both + sign , decimals? %d integers, have use %f floating point. sprintf("%+.2f", $key); unfortunately, can't commas this. wouldn't have worked original code, because %d parses argument integer, , stop reading number when gets comma. if need both sign , commas, can do: ($key >= 0 ? '+' : '') . number_format(floatval($key), 2, '.', ','))

Display AlertDialog in android after specified time -

i'm in situation where, alertdialog should pop after specific time. alertdialog.builder alertdialog = new alertdialog.builder(pdfdisplayactivity.this); alertdialog.settitle(" auto logout"); alertdialog.setmessage("you logged out automatically after 1 minute."); alertdialog.setpositivebutton("yes", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int which) { waittimer = new countdowntimer(60000, 1000) { public void ontick(long millisuntilfinished) { //toast.maketext(getapplicationcontext(), "seconds remaining: " + millisuntilfinished / 1000, toast.length_short).show(); } public void onfinish() { intent logout = new intent(getapplicationcontext(), loginactivity.class); logout.addflags(intent.flag_activity_cle

c# - Force text length + trimming -

i'm using bindings populate listbox , textblock s, etc. the question : how make sure text bound the text property of textblock of specific length , or displayed trimmed @ specific character length (e.g. "some very long t..." ), text doesn't "overflow" phone screen or container? since mango sdk, there property call texttrimming . so xaml <textblock text="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" texttrimming="wordellipsis" width="200" /> will produce somehting "aaaaaaa....."

c# - Socket and ports setup for high-speed audio/video streaming -

i have one-on-one connection between server , client. server streaming real-time audio/video data. my question may sound weird, should use multiple ports/socket or one? faster use multiple ports or single 1 offer better performance? should have port messages, 1 video , 1 audio or more simple package whole thing in single port? one of current problem need first send size of current frame size - in bytes - may change 1 frame next. i'm new networking, haven't found mechanism automatically detect correct range specific object being transmitted. example, if send 2934 bytes long packet, need tell receiver size of packet? i first tried package frame fast coming in, found out receiving end sometime not appropriated number of bytes. of time, read faster send them, getting partial frame. what's best way appropriated number of bytes possible? or looking low , there's higher-level class/framework used handle object transmission? i think better use object mechan

java - Text that contains the apostroph php -

i have serious problem. app retrieves text online database, problem if put text in database contains apostrophe in site displays correctly in application fails me while synchronizing database. enabled magic quote gpc nothing. how can fix? first, disable magic_quote_gpc, deprecated/removed secondly, @ mysqli_real_escape_string() when sending data database (which assumed 'synchronizing database' is).

nsurlerrordomain - NSURL Bad URL error when using stringByAddingPercentEscapesUsingEncoding -

i concatenated 2 strings url, below method concatenating strings: purpose of go url namely: https://vula.uct.ac.za/portal/pda/9f563cb2-24f9-481f-ab2e-631e85c9f3aa/tool-reset/10f71bdb-24b9-4060-bf6d-2c9654253aa3 to shorter url displays part of webpage , is: https://vula.uct.ac.za/portal/tool-reset/10f71bdb-24b9-4060-bf6d-2c9654253aa3 -(nsstring *)cropurl:(nsstring *)inputurl{ nsstring *outputurl ; nsrange match; match = [inputurl rangeofstring: @"tool-reset"]; //gives index , range of string "tool-reset" int toollen = match.location+match.length ; //gives index after "tool-reset" nsstring*tempidentifier = [inputurl substringfromindex:toollen] ; //gets characters after "tool-reset" nsstring *firsturl = @"https://vula.uct.ac.za/portal/tool-reset" ; //first part of url nsmutablearray *concaturl = [[nsmutablearray alloc] initwithcapacity:2] ; // array concat firsturl , tempidentifier [concaturl addobject:(nsstring *)firsturl]

c++ - X,Y Width,Height To OpenGL Texture Coord -

if got 256 x 256 texture, , image that's 32 x 32 @ x: 192 y: 128 , algerithm used use gltexcoord2f draw 32 x 32 image @ x: 192 y: 128 (to cut out other parts of image)? here example of want do. blue/red box i'd want use. want draw box, nothing surrounding it, or whole texture. http://i.imgur.com/ltugfou.png is want? float f = 1.0f/256.0f; glbegin( gl_quads ); gltexcoord2f( 192 * f, 128 * f ); glvertex2f( 192, 128 ); gltexcoord2f( (192 + 32) * f, 128 * f ); glvertex2f( 192 + 32, 128 ); gltexcoord2f( (192 + 32) * f, (128 + 32) * f ); glvertex2f( 192 + 32, 128 + 32 ); gltexcoord2f( 192 * f, (128 + 32) * f ); glvertex2f( 192, 128 + 32 ); glend(); remeber texture coordinates scaled <0,1> interval. intermediate mode deprecated in opengl 3.

linux - how to use kill SIGUSR2 in bash? -

i use iptraf monitor network traffic in linux, , shell command is(make iptraf running in background): iptraf -s eth0 -f -b -l ./traffic.dat if want result, have stop iptraf first, use shell command: kill -sigusr2 $pid however, not stop iptraf if move these shell commands bash script file(net.sh), , error: kill: sigusr2: invalid signal specification i use 'kill -l' in script file(net.sh), , find there no parameter name sigusr2. , nothing if use usr2 or -9. the complete script file is: iptraf -s eth0 -f -b -l ./temp.txt pid=`ps -ef | grep iptraf | grep -v grep | awk '{print $2}'` kill -usr2 $pid cat temp.txt i nothing after these commands. what shoud if want result? sigusr2 architecture depended , can have value out of 31 , 12 or 17 . described in man 7 signal . you'll have find out value appropriate system. done having into: /usr/include/asm/signal.h on system - ubuntu 12.04 amd 64 - has value of 12 : #defi

PHP / Jquery Create and Manipulate Tables -

i'm looking way add additional rows table based on value selected dropdown list or slider.. taking basic table : <html> <head> <title></title> </head> <body> <table border="1"> <thead><tr> <th>name</th> <th>a</th> <th>b</th> <th>c</th> <th>d</th> <th>e</th> <th>f</th> </tr> </thead><tbody> <tr> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td><input type="checkbox"></td> </tr> </tbody> </table> <br> </body> </html> i'd add dropdown or slider allows user increase or decrease number of rows visible , can complete. when form submitted values submitted normal. idea h

Accessing MSMQ via PowerShell -

i have installed msmq feature onto both server (win 2008 r2) , client machine (win 7) using following link . feature appears in server manager , able create public or privet queue through gui. when come try access queue locally on server through powershell (2.0) none of cmdlet's msmq recognized within shell. are there further steps need take access msmq through powershell? there msmq module need load? any advice on appreciated. if click 1 level in link provided you'll see you're looking @ pre-release powershell 4.0 module documentation. here's link parent page. http://technet.microsoft.com/en-us/library/dn249523.aspx powershell community extensions (pscx) has cmdlets working msmq, , works powershell 2.0, though.

R: Converting do.call()-summary in summary -

as stepaic() function mass package has problems when used within function, use do.call() (described here ). problem sounds easy could't find solution it: when use do.call() lm() model several raster layers, layers saved within model. if want print summary() of model, writes layers in output , gets confusing. how "normal" summary output, without using do.call ? here short example: create list of raster layers: xz.list <- lapply(1:5,function(x){ r1 <- raster(ncol=3, nrow=3) values(r1) <- 1:ncell(r1) r1 }) convert them in data.frame : xz<-getvalues(stack(xz.list)) xz <- as.data.frame(xz) use do.call lm model: fit1<-do.call("lm", list(xz[,1] ~ . , data = xz)) the summary() output looks this: summary(fit1) call: lm(formula = xz[, 1] ~ ., data = structure(list(layer.1 = 1:9, layer.2 = 1:9, layer.3 = 1:9, layer.4 = 1:9, layer.5 = 1:9), .names = c("layer.1", "layer.2", "layer.3&quo

machine learning - How to find the Precision, Recall, Accuracy using SVM? -

duplicate calculating precision, recall , f score i have input file text description , classified level (i.e.levela , levelb). want write svm classifier measure precision, recall , accuracy. looked @ scikit , libsvm want know more step step. any sample code or basic tutorial nice. suggestion in advance. these performance measures easy obtain predicted labels , true labels, post-processing step: precision = tp / (tp+fp) recall = tp / (tp+fn) accuracy = (tp + tn) / (tp + tn + fp + fn) with tp, fp, tn, fn being number of true positives, false positives, true negatives , false negatives, respectively.

Jquery multiple select (ctrl click) to multiple select (single click) -

i've been looking around online can't seem find straight answer question have. i have multi-dropdown this: <form action="form_action.asp"> <select name="cars" id="myselect" multiple> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="opel">opel</option> <option value="audi">audi</option> </select> <input type="submit"> </form> now know can select multiple items in list using ctrl+click. i change single click. i've tried few things: simulating ctrl while clicking (which worst idea i've had week). changing selected attribute. gets selection (the visual part of atleast) undone when click next item. i'd prefer not use plugins, unless there no other clean way so. try this. <select multiple> - how allow 1 item selected? working

JQuery Ajax POST in Codeigniter -

i have searched lot of tutorials post methods , saw answered questions here post still doesn't work...i thought should post here if guys see don't! my js - messages.js: $(document).ready(function(){ $("#send").click(function() { $.ajax({ type: "post", url: base_url + "chat/post_action", data: {textbox: $("#textbox").val()}, datatype: "text", cache:false, success: function(data){ alert(data); //as debugging message. } return false; }); }); my view - chat.php: <?php $this->load->js(base_url().'themes/chat/js/messages.js');?> //i use mainframe framework loading script way valid <form method="post"> <input id="textbox" type="text" name="textbox"> <input id="send" type="submit" name=&q

mongodb - Uncaught exception 'MongoCursorException' with message .... duplicate key error index: -

here's code: when try work it, there's error it: "fatal error: uncaught exception 'mongocursorexception' message 'localhost:27017: e11000 duplicate key error index: futbol_db.maclar.$kod_1_link_1 dup key: { : null, : null }' in /var/www/html/cagkansokmen/futbol/db/maclar.php:182 stack trace: #0 /var/www/html/cagkansokmen/futbol/db/maclar.php(182): mongocollection->insert(array) #1 {main} thrown in /var/www/html/cagkansokmen/futbol/db/maclar.php on line 182" the problem insert. because, when drop insert code, there's no problem code. if try insert data, there's error said. how can fix it? $collection1 = $db->lig_kod; $collection_maclar = $db->maclar; $collection1->ensureindex(array("kod" => 1, "link" => 1), array("unique" => true, "dropdups" => true)); $a = $collection1->find(array())->limit(15)->skip(0); foreach($a $b){ $ko