Posts

Showing posts from May, 2010

mysql can't change table or insert data into the table -

i have made table, when try change following error: #1025 - error on rename of '<table name>' '#sql2-532a-5eb06' (errno: -1) when try google shows things related foreign keys, isn't problem, seeing how there no foreign keys or table. i've change permision of table, out success. won't let me insert data table. know else can be. ps. there nothing in logs this edit i've tried recreating table without success try out this disable keys or set foreign_key_checks=0; make sure to set foreign_key_checks=1; after done.

http proxy - How do I use squid as default gateway -

i have installed centos 6.5 my default gateway in infrastructure 192.168.3.1 (which firewall ip) i wanted change centos server ip can limit usage of internet , monitor websites used in network. i dont want setup proxy server setting in browser appreciate :) you have 2 options: first option use iptables firewall , redirect trafic port 80 port 3128. iptables -t nat -a prerouting -p tcp --dport 80 -j redirect --to-ports 3128 second option configure squid lisaning port 80 instead 3128 by default, squid listens on port 3128. if use different port, modify /etc/squid/squid.conf http_port 80 save service squid restart

android - Maintain state between activities -

my app has 2 activities: masteractivity , detailactivity . masteractivity has 2 visualization modes: list mode , map mode . action bar item toggles between them. i'd mantain selected visualization mode when user goes detailactivity , comes back. in beginning used sharedpreferences user previous visualization mode after device boot or long inactivity time, , that's not mean. then switched bundle , onsaveinstancestate but, when user clicks on button of detailactivity , oncreate 's bundle empty can't restore previous visualization mode , reverts list one. app uses toolbar , androidmanifest.xml configured that: <activity android:name=".ui.masteractivity" android:label="@string/title_activity_master" android:theme="@style/apptheme.noactionbar"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.catego

Python: Write a new xml file based on a xml template -

i want generate new xml file (new.xml) based on xml template (template.xml) using xml.etree.elementtree. idea change value of <name> tag 'all' 'new' leaving rest of new.xml file looking template.xml. can change value of the <name> new.xml not same template.xml here template.xml: <?xml version="1.0"?> <example> <version>15.0</version> <lastchange/> <theme>black</theme> <group> <name>all</name> <description><![cdata[all users]]></description> <scope>system</scope> <gid>1998</gid> </group> </example> and here new.xml: <example> <version>15.0</version> <lastchange /> <theme>black</theme> <group> <name>new</name> <description>all users</description> <scope>system</scope> <gid>1998</gid> &

excel vba runtime error 7: out of memory formula length greater than 1024 -

i developed macro user select criteria , have create formulas on selected criteria. getting out of memory error 7 when formula length greater 1024 characters. activesheet.cells(29, 4).formula = quar_dchc_high_8_9_10 the length of string quar_dchc_high_8_9_10 1290 characters. creating problem? formula in quar_dchc_high_8_9_10 =sumproduct(sign('[jan_hc.xls]hc'!$ax$2:$ax$65536="6g"),sign('[jan_hc.xls]hc'!$x$2:$x$65536="female"),sign('[jan_hc.xls]hc'!$ax$2:$ax$65536=8))+sumproduct(sign('[jan_hc.xls]hc'!$ax$2:$ax$65536="6g"),sign('[jan_hc.xls]hc'!$x$2:$x$65536="female"),sign('[jan_hc.xls]hc'!$ax$2:$ax$65536=9))+sumproduct(sign('[jan_hc.xls]hc'!$ax$2:$ax$65536="6g"),sign('[jan_hc.xls]hc'!$x$2:$x$65536="female"),sign('[jan_hc.xls]hc'!$ax$2:$ax$65536=10))+sumproduct(sign('[feb_hc.xls]hc'!$av$2:$av$65536="6g"),sign('[feb_hc.xls]hc&

c# - Restrict usage of parameterless constructor to serialization/Activator/new() -

i've had following question in mind , couldn't find question on so: how can have default constructor serialization/activator purposes, while making sure consumer discouraged/disabled using it? in past i've used hints like ///<summary> /// not use default constructor ///</summary> which overlooked easily, unless hover , check every class use. while better visual indication this: [obsolete("do not use default constructor")] it complete abuse of feature leaves me shivering. is there common way i'm not aware of deal this, or me feels annoyed in first place? if class within class library, , serialization happens class library itself, can create internal wrapper class (deriving original class) exposes serialization constructor. in way, can make sure nothing outside calling constructor. approach, have use wrapper type when deserializing. that still mean constructor can called inside class library of course, prevents of unin

how to calculate Jaccard index using segmented image with contour of original iamge in matlab -

i have segmented image , got contour of original image using command imcontour(original_image,1) , have used code calculate jaccard index in matlab.i new in matlab please me.here code have used function [jaccardidx,jaccarddist] = jaccard_coefficient(img_orig,img_seg) img_orig = logical(img_orig); img_seg = logical(img_seg); if ~islogical(img_orig) error('image must in logical format'); end if ~islogical(img_seg) error('image must in logical format'); end inter_image = img_orig & img_seg; union_image = img_orig | img_seg; jaccardidx = sum(inter_image(:))/sum(union_image(:)); jaccarddist = 1 - jaccardidx; but , @ time of intersection of 2 images, error comming matrix dimensions must agree , not able resolve it.thanks in advance please me. after reading comments understand reason failure fact using matrices different dimensions: ground truth image bigger segmentation image([121 167] vs [120 161]). in g

java - Android drawable swiping not working (from beginners sample code) -

i'm fluent in java years never tried making apps. 2 days ago started , 20 minute work getting android studio on setting in netbeans show hello world app on phone. i'm stuck approach swiping through array of jpg's. app gets build , started, not displaying of pics. please have look. package vf.base; import android.app.activity; import android.content.res.typedarray; import android.os.bundle; import android.view.motionevent; import android.view.viewgroup; import android.widget.imageview; import android.widget.viewflipper; public class mainactivity extends activity { private viewflipper viewflipper; private typedarray pics; private onswipetouchlistener onswipetouchlistener; /** * called when activity first created. */ @override protected void oncreate(bundle savedinstancestate) { pics = getresources().obtaintypedarray(r.array.pics); super.oncreate(savedinstancestate); setcontentview(r.layout.main);

how to convert 123456,123456,B-CAT to '123456','123456','B-CAT' in python -

by using query select group_concat(productid) blog_txstock lastupdateon between ('2016-05-01 00:00:00') , ('2016-05-09 00:00:00'); i getting result like 123456,123456,b-cat but want convert result in to '123456','123456','b-cat' you need change outer quotes: >>> s = '123456,123456,b-cat' >>> ",".join("'{0}'".format(i) in s.split(',')) "'123456','123456','b-cat'" in case wondering why showing " " that's way represented, if save resulting value , print it, result want. >>> r = ",".join("'{0}'".format(i) in s.split(',')) >>> print(r) '123456','123456','b-cat'

audiocontext - Change tempo of audio file without changing the pitch of the clip -

i created audiocontext instance suing web audio , , loaded music file audiobuffer , can play songs , , question is:is there way can set tempo of audiosource(audiobuffer) node , play accordingly ? i have tried var context = audiocontext(); source= context.createbuffersource(); context.nodes.push(source); source.buffer = audiobuffer; source.playbackrate.value = 1.5; and problem above , changing pitch of audio files, how change tempo without changing pitch ?.

npm - The package rxjs@5.0.0-beta.6 does not satisfy its siblings' peerDependencies requirements? -

i trying install @ngrx/store module in angular 2 app. using npm install , getting following error: npm err! peerinvalid package rxjs@5.0.0-beta.6 not satisfy siblings' peerdependencies requirements! npm err! peerinvalid peer @angular/core@2.0.0-rc.0 wants rxjs@5.0.0-beta.6 npm err! peerinvalid peer @angular/http@2.0.0-rc.0 wants rxjs@5.0.0-beta.6 npm err! peerinvalid peer angular2@2.0.0-beta.16 wants rxjs@5.0.0-beta.2 npm err! peerinvalid peer @ngrx/store@1.5.0 wants rxjs@5.0.0-beta.6 does mean have upgrade angular2 module because needs lower version of rxjs@5.0.0-beta.2? the problem have both beta.16 , rc.0 dependencies in same project. since angular changed npm package name between two, need uninstall , remove dependencies on whichever 1 don't want. assuming want upgrade rc.0, remove package.json , run: npm uninstall angular2

c++ - Modem does not return my program's echo request -

typing at + [enter] on putty modem's com3 port gives me ok response. i used char-sending-and-recieving program analyze putty's output when sends data. at + [enter] makes putty send at\r through port. ( \r meaning carriage return ascii value of 13.) i used program send same stream of chars com3 port. modem didn't respond ok . doesn't send response program @ all. ever. not error messages. (i tested program, , can recieve data right after sending data of own, unlikely didn't catch ok in time, since requested longer strings response - strings hard miss.) (it has no problems communicating through ports program , putty.) what cause this? how can recieve modem's ok response? (i tested strings ending \n , \r\n , \n\r advised, in case. didn't work.) code (ports com8 , com9 connected btw): #include <iostream> #include <windows.h> #include <conio.h> using namespace std; bool writecomport(lpctstr portspecifier, l

mysql - how to display php search results in bootstrap modal? And Modal is disappearing after displaying results? -

i developing job portal users search jobs, while searches results should shown in bootstrap pop-up modal, code working modal disappearing after showing results i tried code below <form action="" method="post"> <div class="input-group" id="adv-search"> <input type="text" name="term" class="form-control" placeholder="search jobs" /> <div class="input-group-btn"> <div class="btn-group" role="group"> <button type="submit" name="submit" value="search" class="btn btn-primary"data-toggle="modal" data-target="#mymodal"> <span class="glyphicon glyphicon-search" aria-hidden="true"></span> </button> </div> </div> </div> </div> </form>

php - Remove public folder in zend framework 2 -

is there way change default folder structure of zend framework 2? specific need remove/rename public folder. also, remove public url also. tried many things using htaccess nothing works zend 2. the default folder structure convention, there's nothing particular relies on it. however, sensible convention, , instead of trying change should try , fix real problem instead. if public/ appearing in url, either virtualhost not setup correctly or you're using shared hosting , can't change virtualhost. installation instructions have example vhosts apache - key thing having document root pointing @ public folder, not application root.

java - Getting Error MessageBodyWriter not found for media type=application/json -

Image
i implementing small application rest webservice , want response in json formate. getting error on eclipse console . please me out. org.glassfish.jersey.message.internal.writerinterceptorexecutor$terminalwriterinterceptor aroundwriteto severe: messagebodywriter not found media type=application/json, type=class book.test, generictype=class book.test. web.xml file : all jar files : i have added dependencies jar still getting same error. thanks. looks you're missing dependency: enabled pojomappingfeature in settings need include jersey-media-moxy or jersey-media-json-jackson in dependencies. since beans have jaxb annotation guess you'll want both xml , json serialization, moxy choice.

android - Send a SMS using SMSmanager in Dual SIM mobile? -

can me. have script sms android. script working properly. have problem dual sim card mobile phone. script sent messages in sim card 1. not on sim card 2. can fix script below. package com.contohaplikasismssederhana; import android.app.activity; import android.content.contentvalues; import android.content.intent; import android.database.cursor; import android.net.uri; import android.os.bundle; import android.provider.contactscontract; import android.provider.contactscontract.commondatakinds.phone; import android.telephony.smsmanager; import android.view.view; import android.view.view.onclicklistener; import android.widget.edittext; import android.widget.imagebutton; import android.widget.toast; import android.widget.radiobutton; import android.widget.radiogroup; import android.widget.radiogroup.oncheckedchangelistener; public class buatpesan extends activity { edittext nomorkontak, text, simbol, alamat, telp, usaha, keterangan, aplikasi; radiobutton rb0, rb1; radiogr

java.lang.UnsupportedClassVersionError: com/google/doclava/Doclava : Unsupported major.minor version 51.0 android build -

i trying build own aosp google source. follwed steps mentioned in google documents , able build , flash device images successfully. however, tried building again after making changes (basically added logs play around it). build errored out. tried make again, said javac 1.6 found. required javac 1.7 . followed answers particular problem using following command: update-alternatives --config javac there 2 choices alternative javac (providing /usr/bin/javac). selection path priority status ------------------------------------------------------------ 0 /usr/lib/jvm/java-7-openjdk-amd64/bin/javac 1051 auto mode * 1 /usr/lib/jvm/j2sdk1.6-oracle/bin/javac 315 manual mode 2 /usr/lib/jvm/java-7-openjdk-amd64/bin/javac 1051 manual mode i selected option 0. tried make again. time failed following error: java.lang.unsupportedclassversionerror: com/google/doclava/doclava : unsup

excel - Is Power Pivot Multi Dimensional? -

i created multi dimensional pivot table in excel , used following add on generate mdx: http://olappivottableextend.codeplex.com/releases/view/618637 the mdx generated excel follows: select non empty hierarchize(drilldownmember({{{drilldownlevel({[customer].[customer geography].[all]},,,include_calc_members)}}}, {[customer].[customer geography].[state province].&[new south wales]&[australia]},,,include_calc_members)) dimension properties parent_unique_name,hierarchy_unique_name,[customer].[customer geography].[state province].[country-region],[customer].[customer geography].[city].[state province] on columns , non empty hierarchize({drilldownlevel({[customer].[fullname].[all]},,,include_calc_members)}) dimension properties parent_unique_name,hierarchy_unique_name on rows [adventure works dw2012] ([measures].[sales amount]) cell properties value, format_string, language, back_color, fore_color, font_flags i opened power pivot windows , copied , pasted mdx. generated 2

Check for multiple registry keys in batch file -

i need check registry multiple keys before start program (they shouldn't exist). spread solution checking registry keys works 1 check since sets global errorlevel 1. example below won't work correctly. @echo off reg query hkey_local_machine\software\mykey >nul if %errorlevel% equ 0 ( echo "mykey exists - nothing" ) else ( reg query hkey_local_machine\software\mykey2 >nul if %errorlevel% equ 0 ( echo "mykey2 exists - nothing" ) else ( run program ) ) using errorlevel require delayed expansion .you can try if errorlevel @echo off reg query hkey_local_machine\software\mykey >nul if %errorlevel% equ 0 ( echo "mykey exists - nothing" ) else ( reg query hkey_local_machine\software\mykey2 >nul if errorlevel 1 ( run program ) else ( echo "mykey2 exists - nothing" ) )

f# - Catching HttpClient timeouts within an async workflow -

i'm calling httpclient via async.awaittask , being called within agent (mailboxprocessor). wanting catch errors during http call used try...with in async workflow, misses catching client-side timeout exceptions cause agent crash. minimal reproduction: #r "system.net.http" open system open system.net.http let client = new httpclient() client.timeout <- timespan.fromseconds(1.) async { try let! content = async.awaittask <| client.getstringasync("http://fake-response.appspot.com/?sleep=30") return content ex -> // not catch client-side timeout exception return "caught it!" } |> async.runsynchronously // throws system.operationcanceledexception: operation canceled i can fix making syncronous, prefer keep whole stack async might running lot of these in parallel: #r "system.net.http" open system open system.net.http let client = new httpclient() client.timeout <- timespan.fromse

Working with and importing external libraries / frameworks in Java -

firstly n00b question. being junior dev i've never needed import , work other java frameworks. standard library enough me write classes needed write. but getting exposed more "advanced" concepts, need start working external frameworks, e.g. json java, apache's httpclient java , on. , i'm looking basic understanding on how works , how go importing these libraries can start working classes... so initial understanding each of these fraemworks provide .jar file contains classes framework. import project , lo , behold you'll able use classes/library in project importing e.g. 'import org.json.*;' is understanding correct? correct. you add libraries classpath , able use classes these libs. how add libs classpath depends on actual development environment. if use apache maven example, have define dependencies (libs) in projects pom.xml , maven downloads them automatically you. hth, - martin

How to case match a View in scala -

i'm implementing class constrain access on iterable. intermediate steps of sequence (after map, etc...) expected big memory. map (and likes: scanleft, reduce, ...) should lazy. internally use map(...) = iterable.view.map( ... ) . seems, iterableview.view not it-self, produce useless redirection when calling map multiple times. not critical, i'd call .view if iterable not view. so, how can case-match view? class lazyiterable[a](iterable: iterable[a]){ def map[b](f: => b) = { val mapped = iterable match { case v: view[a] => v // should here? case i: iterable[a] => i.view }.map( f )) new lazyiterable(mapped) } def compute() = iterable.tolist } note don't know inputed iterable, concrete seq (e.g. list, vector) or view. , if view, don't know on concrete seq type (e.g. interableview, seqview, ...). , got lost in class hierarchy of view's & viewlike's. v: iterableview[a,_] looking ...

Image file not received from android emulator to server -

i trying send image android emulator php server. java file shown below : public class mainactivity extends activity implements onclicklistener { private static final int result_load_image = 1; private static final string serveraddress = "http://localhost"; // 14.99.139.53 imageview imagetoupload, downloadedimage; button buploadimage, bdownloadimage; edittext uploadimagename, downloadimagename; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); imagetoupload = (imageview) findviewbyid(r.id.imagetoupload); downloadedimage = (imageview) findviewbyid(r.id.downloadedimage); buploadimage = (button) findviewbyid(r.id.buploadimage); bdownloadimage = (button) findviewbyid(r.id.bdownloadimage); uploadimagename = (edittext) findviewbyid(

"Fortinet SSL-VPN Client plugin is not installed on your computer" when using Firefox 22+ to access FortiGate site -

i have fortigate client installed , not disabled. worked until upgraded firefox version 22. how work new version? this known bug related firefox issue. ssl vpn client plugin's not work if running firefox version higher 20 reference bug id (0211153).the purposed workaround @ time download stand alone sll vpn client.please see link given below downloading stand alone ssl vpn or go on previous version (like 21) download sslvpnclient.msi http://dekiwiki.ties2.net/fortinet/fortinet_ssl_vpn_client_installers

curve fitting - How can I make a B spline with specific values of 1st derivative at breakpoints (not only ends) using MATLAB? -

i used csape function in curve fitting toolbox, enables user of choosing derivative values @ both ends. is there way control value of derivative specific breakpoint? i want set 1 of values of derivatives 0 @ 1 breakpoint, make maximum. here code: %% times k=0; tc = 1; %step time in second td = .15*tc; %the dsp time t0=k*tc; t1=t0+td; t2=t0+tc; t3=t2+td; tm=.5*tc; tmaxh=t0+tm; %% z height hgs=0; hge=0; hao=.12; lan=.079; laf=.2; lab=.05; ds=.6; lao=.6667*ds; qb=10; qf=10; %% spline generation using cublic spline. tt=[t0 t1 tmaxh t2 t3]; zz=[hgs+lan hgs+laf*sind(qb)+lan*cosd(qb) hao hge+lab*sind(qf)+lan*cosd(qf) hge+lan]; cs = csape(tt,zz,[1 0 0 0 1],[0 0 0 0 0]) figure fnplt(cs) after comment %% spline generation using cubic spline. have 2 vectors 1 time , 1 value changes time , want make b-spline of 3rd order. i used csape because enables user determine value of derivatives @ end points. cs = csape(tt,zz,[1 0 0 0 1],[0 0 0 0 0]) ones tell tool make 1st derivativ

c# - Post method not execute using RestSharp in webAPI asp.net -

var request = new restrequest("controller", method.post); request.addjsonbody(object); client.execute(request); "controller" controllername derive apicontroller , client localhost api address, object data pass. controller method: public void post(object obj) { }

php - Simple slim session manager not read session in a different function -

i using following slim session manager( https://github.com/bryanjhv/slim-session ). have separate functions login , logout , user_data . $app->post("/login", function() use ($app) { $input = $app->request()->getbody(); $input = json_decode($input); try { if ($input->username && $input->password) { $user = model::factory('users')->where("username",$input->username)->where("password",md5($input->password))->find_one(); $session = new \slimsession\helper; //set session $session->set('userid', $user->id); $status = 'success'; $message = 'logged in successfully.'; } else {

c# 6.0 - C# 6 how to format double using interpolated string? -

i have used new features of c# 6 incl. interpolated string simple usage (showing message contains string variables $"{employeename}, {department}"). now want use interpolated string showing formatted double value. example var anumberasstring = adoublevalue.tostring("0.####"); how can write interpolated string? $"{adoublevalue} ...." you can specify format string after expression colon ( : ): var anumberasstring = $"{adoublevalue:0.####}";

javascript - Print the radio button value in next page in ruby -

hi using 2 radio buttons: <input type="radio" id="radio0" name="answer[16]" value="domestic" checked> <label for="radio0">domestic</label> <input type="radio" id="radio1" name="answer[16]" value="international"> <label for="radio1">international</label> i want print these selected radio button value in next page : usage of documents: domestic any idea how implement in ruby? i have seen eg in stackoverflow. getting little bit confused how implement in code: discussion of stackoverflow below: to radio button value in ruby on rails <div id = "option-1"> <%= radio_button_tag "answer", "#{@ans.id}ans1"%><%= @ans.ans1 %> </div> <%= f.radio_button :answer, "#{@ans.id}ans1" %>

websocket - GO - Code stops executing after function return -

so, i'm trying construct websocket server in go. , ran interesting bug, cant life of me figure out why happening. note: comments in code snippets there post. read them . ive got function: func join(ws *websocket.conn) { log.connection(ws) enc := json.newencoder(ws) dec := json.newdecoder(ws) var dj g.discussionjoin var disc g.discussion log.err(dec.decode(&dj), "dec.decode") ssd := g.finddiscussionbyid(dj.discussionid) ssdj := dj.convert(ws) g.dischandle <- &ssdj disc = ssd.convert() log.err(enc.encode(disc), "enc.encode") log.activity("discussion", "joined", disc.discussionid.subject) fmt.println("listening") //this gets called g.listen(dec) fmt.println("stoped listening") //this doesn't called [it should] ssdj.ssdiscussion.leave(ssdj.ssuserid) log.disconnection(ws) } the function thats causing (in opinion) g.list

iphone - How to enable audio controls in multitasking bar for app that uses AVAudioPlayer? -

this question has answer here: how enable ipod controls in background control non-ipod music in ios 4? 3 answers our music app uses avaudioplayer play music. in background, multitasking bar not show play/pause/stop controls control audio of our app. there way it? yes, have use class: mpnowplayinginfocenter class reference if have specific questions it, ask.

machine learning - How to randomly split a dataset into training set, test set, and dev set in Python? -

i have large dataset , want randomly split dataset 70% train, 25% test, , 5% dev. how can in python scikit-learn? i wonder if using sklearn.cross_validation.train_test_split(*arrays, **options) function example in following link? http://scikit-learn.org/stable/modules/generated/sklearn.cross_validation.train_test_split.html you use: from numpy.random import multinomial n_total_samples = 1000 # or whatever indices = np.arange(n_total_samples) inds_split = multinomial(n=1, pvals=[0.7, 0.25, 0.05], size=n_total_samples).argmax(axis=1) train_inds = indices[inds_split==0] test_inds = indices[inds_split==1] dev_inds = indices[inds_split==2] print len(train_inds) / float(n_total_samples) # => 0.713 print len(test_inds) / float(n_total_samples) # => 0.24 print len(dev_inds) / float(n_total_samples) # => 0.047 it's not pretty built-in function, believe need.

Passing array of structs to a function in Go -

i have object parsed xml file. has struct type this type report struct { items []item `xml:......` anotheritems []anotheritem `xml:......` } type item struct { name string } type anotheritem struct { name string } func (item *item) foo() bool { //some code here } func (anotheritem *anotheritem) foo() bool { //another code here } for each item have smth this: func main(){ //some funcs called report object dosmth(report.items) dosmth(report.anotheritems) } func dosmth(items ????){ _, item : range items { item.foo() } } since have different items same function want have 1 dosmth can't dosmth(items []item) , question - should write instead of "????" working? way made pass report.items dosmth() func dosmth(items interface{}) but throws me error "cannot range on items (type interface {})" , if instead of iteration put smth func dosmth(items interface{}){ fmt.println(items) } program print li

javascript - Resizing inner div on resizing size of dijit.layout.BorderContainer -

i have div of dojotype dijit.layout.bordercontainer , , trying set size of bordercontainer dynamically respect size of viewport. html code create border container <div dojotype="dijit.layout.bordercontainer" design="sidebar" gutters="true" livesplitters="true" id="bordercontainer" style="border: solid green 3px;"> <div dojotype="dijit.layout.contentpane" splitter="true" region="leading" style="width: 230px; padding:2px 0px 0px 0px;"> </div> </div> i updating size of border container using following javascript code var viewport = dojo.window.getbox(dojo.doc); dojo.setstyle('bordercontainer','height','430px'); but on executing code able see size of div of type border container changed, div inside div of type bordercontainer not changing. you need call resize on widget , widget resize children. var viewport

swift - Core Data generates an NSManagedObject subclass with a property of type NSNumber, but it's a Bool -

i created core data data model , added entities. i'm generating nsmanagedobject subclasses. in generated code, found 1 of properties, type "boolean" in data model, has turned property of type nsnumber ! that's not correct, thought. nsnumber not boolean. why doesn't use bool type? then thought might 1 of annoying things of objective-c. think int , double , bool cannot saved core data has use nsnumber . right? how convert nsnumber bool , how convert bool nsnumber ? maybe 0 = false , 1 = true? other values? isn't type-safe @ all... for question how convert nsnumber bool , how convert bool nsnumber? u can below, nsnumber objects //convert bool number nsnumber *boolinnumber = [nsnumber numberwithbool:yes]; //or no //get back, convert number bool nsnumber *anum = [nsnumber numberwithbool:yes]; //get nsnumber instance bool numberinbool = [anum boolvalue]; and aslo u can convert other types, more info check class reference hear

ruby - Connection refused when using Rack Proxy -

i'm trying catch *.dev requests on port 80 , send them right rack project using rack proxy . i'm able catch requests , based on uri i'll config.ru in specific folder. when i'm able find 1 i'll boot server on port 3000. after that, whenever recieve request on port 80, try set http_host localhost:3000 , i'm getting message unexpected error while processing request: connection refused - connect(2) "localhost" port 3000 . able access application through localhost:3000 , not through *.dev domain. tried using different ports, that's not working either, guess has user that's running it. however, hope can me this. require 'rack-proxy' class appproxy < rack::proxy def rewrite_env(env) request = rack::request.new(env) site = request.host[0..-5] uid = file.stat(__file__).uid path = etc.getpwuid(uid).dir + '/software/applications/' front_controller = "#{path}#{site}/config.ru" if file.fi

android - How to create layout for "small" devices with sw qualifier? -

as understand layout-small , layout-normal , layout-large deprecated , recommended way of creating layout devices' set use sw. example layout-sw320 devices have 1 of it's side value >= 320dp. "small" , "normal" devices have same sw. so question how distinguish "small" , "normal" devices sw qualifier? possible? need fall old style ? the new device dimension classifiers aim support based on smallest width of device; not height. if application relying on height, have support orientations separately or disable them using screenorientation property in androidmanifest.xml <activity> attribute. for example, using screenorientation="sensorportrait|portrait" allows rely on swxxx only, if support screen orientations can support them with: layout-w320-port , called small and large screens in old specification when in portrait edit: use layout-w320-h426-port , layout-w320-h470-port when want differe

c# - Detecting where mono is installed on Windows -

how can directory or more info c# run-time? the recipe here: http://community.sharpdevelop.net/blogs/mattward/archive/2005/10/17/detectingwheremonoisinstalled.aspx doesn't work more guess.

Save a Pymol-movie in Python -

how can save pymol-movie in python? saving frames png-files [cmd.png()] , play movie [cmd.mplay()]. relevant documentation here: http://www.pymolwiki.org/index.php/making_movies in short, looks pymol not offer way generate gif or movie files. instead, recommend using third-party program work of stitching png files whichever format want. page linked describes several options; here's one, using mencoder , comes packaged open source movie player mplayer : mencoder "mf://*.png" -mf type=png:fps=18 -ovc lavc -o output.avi there plenty of command line options can specify fiddle output file; read doc linked more examples, read mencoder docs, try other options, find works best you.

iOS Apple Developer App Guidelines -

i've read through apple's ios app submission guidelines , although question more in regards rules (if applicable) after it's been approved. basically i'd know if developer allowed disable functionality in older version of app user forced upgrade newer version? include making user download separate app (that functionality in old version) in process. is allowable, or there says that's against guidelines/rules? if knows answer , provide source of info great. thx. you can't force user upgrade app if want or there no other option can launch app store users can latest version there. or can display ui nothing except giving update option!! [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:ituneslink]]; //your app's itunes link open when user open app you can refer apple forums , can check this answer . hope :)

python - Return row/column values from array underneath lines -

what i'm trying generate multiple lines on binary image based on length , angle. return of row/column values along pixel values underneath lines , place them python list. generate lines wrote function outputs start , end coordinates of each line. using these coordinates want generate lines , extract values. to extract values horizontal line pixel (0,1) (3,1) can do: a = np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) pixels = a[1, 0:3] or vertical: pixels = a[0:3, 1] which returns array of pixel values underneath line: array([3, 4, 5]) array([1, 4, 7]) how apply method on lines angle? x1,y1 , x2,y2? these return (syntax) errors: a([0,0], [2,2]) a([0,0]:[2,2]) a[0,0:2,2] i'm looking similiar ' improfile ' in matlab. many help! you can use scikits-image's draw module , draw.line method: >>> skimage.draw import line >>> y0 = 1; x0 = 1; y1 = 10; x1 = 10; >>> rr, cc = line(y0, x0, y1, x1) rr , cc contain row ,

How to compile AVR code in Arduino? -

why following code not work in arduino? #include<avr/io.h> void setup() { ddra = 0xff; } void loop() { porta = 0xaa; _delay_ms(1000); porta = 0x55; _delay_ms(1000); } i following error. "ddra not declared in scope." as know, arduino uses avr microcontrollers, why can't use avr code in arduino boards? user261391 has first issue code. find need include delay.h delay work. revised example: #include<avr/io.h> #include<avr/delay.h> void setup() { ddrb = 0xff; } void loop() { portb = 0xaa; _delay_ms(1000); portb = 0x55; _delay_ms(1000); }

css - Create box-shadow to drop-shadow mixin -

i'm trying write mixin should take argument css box-shadow , convert filter: drop-shadow() . // mixin drop-shadow($shadows) $array = split(',', $shadows) $dropshadows = () $shadow in $array push($dropshadows, 'drop-shadow(' + $shadow + ')') filter: unquote(join(' ', $dropshadows)) // usage body drop-shadow: 0 0 1px, 0 0 1px the problem must pass value of drop-shadow string make work, if pass array, doesn't... // works drop-shadow: '0 0 1px, 0 0 1px' // doesn't work drop-shadow: 0 0 1px, 0 0 1px ok, found solution: // custom property (mixin) allows define box-shadow // rendered `filter: drop-shadow()` // // usage: // drop-shadow: 2px 0 1px rgba(0,0,0,0.5) // => filter: drop-shadow(2px 0 1px rgba(0,0,0,0.5)) drop-shadow() $array = arguments $dropshadows = () $shadow in $array push($dropshadows, 'drop-shadow(' + $shadow + ')') filter: unquote(join(' ', $d

data structures - site link search box shopify -

i want include input box on site a; after type in query , press enter, open new tab display search results of b. if had typed search query b directly. set form handle search. make it's action parameter address of site b's search handler. give target attribute of _blank e.g. <form action="https://storeb.myshopify.com/search" method="get" target="_blank"> <input name="q" type="text"> <input type="submit" value="submit"> </form> these basics. can match of current site adapting code theme. code @ may in theme's folders under templates/search.liquid.

MxGraph: Is it possible to render a graph in HTML without SVG? -

i'm looking way render graph in html, solely using mxgraph javascript, without use of svg canvas. user manual says: mxgraph includes feature render entirely using html, limits range of functionality available, suitable more simple diagrams." however, i've tried following without success: var editor = new mxeditor(); var graph = new mxgraph(graphcontelem, new mxgraphmodel(), 'fastest'); // fastest maps stricthtml graph.sethtmllabels(true); graph.dialect = mxconstants.dialect_stricthtml; editor.graph = graph; editor.creategraph(); adding cell: var prototype = new mxcell('<input type="text" value="test" />', new mxgeometry(0, 0, w, h), style); prototype.setvertex(true); ... import cells ... leads this: <svg style="width: 100%; height: 100%; display: block; min-width: 1px; min-height: 1px;"> ... <g transform="translate(104,61)"> <foreignobject style="overflow:vi

asp.net - Javascript variable in asp block code -

i have lot of checkboxes needs execute same javascript function when checked/unchecked. parameter enclose control's server id. hope actual checkbox using id. problem need find client id, expected can't use javascript variable mycontrolsserverid inside asp code blocks id. stuck: function show(mycontrolsserverid) { var checkbox = document.getelementbyid('<%= mycontrolsserverid.clientid %>') //more omitted code } how can clicked checkbox? use jquery achieve this. at document load initialize jquery listen checkboxes on page. moment click on 1 of these, can whatever want it: $(document).ready(function() { $("input:checkbox").click(function(e) { alert($(this).attr('id')); }); }); download latest jquery version on http://jquery.com/download/

Elm: Chain Http.send and Http.get -

i'm (a beginner) having type issue trying chain http calls in elm application: http.send ... `task.andthen` (\_ -> http.get ...) this because http.send return type task rawerror response , , http.get return type task error value . any suggestion on how make them work together? edit1: maybe maperror solution? edit2: i'm not saying first call failed, i'm sure works. compiler doesn't validate code: the right argument of `andthen` causing type mismatch. 135│ http.send http.defaultsettings config 136│> `task.andthen` (\_ -> http.get (json.decode.list userjsondecoder) "http://localhost:3000/") `andthen` expecting right argument a: http.response -> task http.rawerror right argument is: http.response -> task http.error (list user) you need way map rawerror error , can use task.maperror suggested in first edit. 1 possibility be: rawerrortoerror : http.rawerror -> http.error rawerrortoerror raw