Posts

Showing posts from August, 2012

debugging - Jtag Trace 32 - setting breakpoint in range of addresses -

this question on jtag. i trying set read/write breakpoint in range of addresses. command give in b.set window follows(and selecting read/write) a:0x8500000..0xd300000 but when list it(b.list) shows follows : an:0x0:0x8500000--0xd300000 why 0x0 getting appended? so, original range of addresses @ wanted put breakpoint altered? additional information : using lauterbach trace 32. cpu arm krait thank you. 0x00 space id. 0 complete kernel space. user spaces space id process id. space id's nothing address space identifiers, used tlb differentiate pagetable ebtries.

actionscript 3 - Add a movieclip but make sure it isn't in the same place as another movieclip. (as3) -

so have this add movieclips clicking, unefficient , doesn't have functionality want, need add movieclip if no other movieclip in same place. private function onclick():void { if(placesound==false) { placepixel.play(); placesound = true; } if(erasetrue==false) { var pixel = new pixel(); pixel.x = 0; pixel.y = 0; } if(mousey>30 && irontrue==true) { //var pixel = new pixel(); pixel.x=(math.round(mousex/5)*5)-2.5; pixel.y=(math.round(mousey/5)*5)-2.5; pixel.graphics.beginfill(0x999999); pixel.graphics.drawrect(0, 0, 5, 5); pixel.graphics.endfill(); pixel.type=0; pix.push(pixel); //addchild(pixel); } if(mousey>30 &...

scipy - ImportError: cannot import name eigen_symmetric in Python? -

i copy , paste pca code here . however, encounter following error: importerror: cannot import name eigen_symmetric why happenning , how fix it? the eigen_symmetric function has been renamed eigsh in scipy 0.9.0 . need find , replace occurences of eigen_symmetric eigsh .

How to use POST in sending data in JSON in android? -

i don't know if i'm doing right way of sending data in json using post. want send single data on jsonobject "reportcode". got far? please tell me what's wrong on code , should need pass data in json. thanks. public class dopost extends asynctask<string, void, boolean> { exception exception = null; private progressdialog progressdialog; context mcontext = null; bufferedreader in; inputstream is; public dopost(context context) { mcontext = context; } protected void onpreexecute() { progressdialog = new progressdialog(mcontext); progressdialog.setmessage("validating...."); progressdialog.show(); progressdialog.setcancelable(false); } @override protected boolean doinbackground(string... arg0) { jsonobject jobject = new jsonobject(); try{ jobject.put("reportcode","13-t001"); list<namevaluepair> pairs = new arraylist<namevaluepair>(); pair...

javascript - How to make ZeroClipboard work with a single click? -

i have working example here http://enginiku.byethost17.com/stack.php what want copy data clipboard based on block clicked. works fine. problem need click on block, move cursor away block, click again , data gets copied. understand maybe because of area turning flash object. but want copy data in 1 click only(the first time). kindly suggest way out !! here script <script> function copytocb(el){ var id = $(el).attr('id'); zeroclipboard.setdefaults({moviepath:'http://enginiku.byethost17.com/zeroclipboard.swf'}); var clip = new zeroclipboard($('#'+id)); clip.on('complete',function(client,args){ alert('copied'); }); } </script> and here relevant html <div class="central"> <div class="maincontent"> <div class="leftcontent"> <span id="ss">some text</span> </div> <div class="rightcontent"> ...

android - How to make if back to previous fragment Tab ViewPagerIndicator not reload again? -

i have error tab viewpagerindicator, if if or swipe previous fragment reload... this code fragment package com.droidersuin.project.viewpagerindicator; import com.droidersuin.project.app.contentactivity; import android.content.context; import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmentpageradapter; public class viewadapter extends fragmentpageradapter{ private context _context; string[] page_titles; public viewadapter(context context, fragmentmanager fm, string[] page_title){ super(fm); _context = context; this.page_titles = page_title; } @override public fragment getitem(int position) { // todo auto-generated method stub fragment f = new fragment(); switch(position){ case 0: f = contentactivity.newinstance(_context); break; case 1: f = contentactivity.newinstance(_context); break; cas...

visual studio - How to display shared calendar in outlook using c#? -

i want'to display shared calendar. search on web , find code: static void main(string[] args) { outlook.application objolapp; outlook.mapifolder objfolder; outlook.explorer objexplorer; outlook.mapifolder objsubfolder; outlook.appointmentitem objcalenderitem; outlook.folders objoutlookfolders; int intfolderctr; int intsubfolderctr; int intappointmentctr; // >> initialize base objects objolapp = new outlook.application(); objoutlookfolders = objolapp.session.folders; // >> loop through pst files added n outlook (intfolderctr = 1; intfolderctr <= objoutlookfolders.count; intfolderctr++) { objfolder = objoutlookfolders[intfolderctr]; objexplorer = objfolder.getexplorer(); // >> loop through folders in pst file (intsubfolderctr = 1; intsubfolderctr <= objexplorer.currentfolder.folders....

jquery - Pass JSON Object to WCF Service getting NULL message -

i want pass json object wcf service, here service method: [operationcontract] [webinvoke(method = "post", requestformat = webmessageformat.json, responseformat = webmessageformat.json, bodystyle = webmessagebodystyle.wrapped)] string insertuserdetails(userdetails userinfo); public string insertuserdetails(userdetails userinfo) { return "welcome"; } calling jquery : $.ajax({ type: 'post', url: url, contenttype: "application/json", data: json.stringify({ userinfo: data }), datatype: "json", success: function (result) { alert(result); } }); here getting null message in alert this should work unless have issues in endpoint configuration. check that. not know how pass 'data' object. below code work me. var serviceurl = "service.svc/insertuserdetails...

java - Take input from the User -

i have been learning java since last 2 months , new stackoverflow well. in class, told there 7 methods can take input user , read (or calculation or whatever). but, taught one, using inputstreamreader. as have understood through stackoverflow, using scanner class general practice. want know method best one, , if makes difference method use. thanks in advance help. i want know method best one? no 1 can answer generic question you! have use best suits requirement. here link i/o methods used in java.

xaml - How to set TargetType to this in WPF? -

i have custom usercontrol (e.g. called myusercontrol ) several child controls. create usercontrol.resources set of styles , dependency properties assignments design purposes (without styles control looks ball of mud). later comment styles. the problem is, don't know how set targettype of style in order point out usercontrol being developed. here example how like: <usercontrol.resources> <style targettype="this"> </style> </usercontrol.resources> you can this: <usercontrol x:class="yourprojectname.usercontrol1" xmlns:local="clr-namespace:yourprojectname" <usercontrol.resources> <style targettype="{x:type local:usercontrol1}"> <setter property="background" value="green"></setter> </style> </usercontrol.resources> </usercontrol>

How to add Mailchimp to existing signup box -

i'm new mailchimp. add mailchimp existing php based signup form. don't want use forms mailchimp. i've searched on google didn't find solution yet. how can that? i wrote short tutorial facing issue. please check here: http://www.sunarlim.com/2014/04/mailchimp-sign-form-php-jquery-ajax/ mailchimp apis easy understand , provide massive list of references , own libraries developers implement.

Android ImageView duplicated content LazyLoad -

i have problem lazy loading images imageviews. when scroll down, see images top (dupliacated), when new image downloaded replaced new one. how can show on new images progressbar, , replace images when downloaded? here getview() lazyadapter: public view getview(int position, view convertview, viewgroup parent) { view vi=convertview; if(convertview==null) vi = inflater.inflate(r.layout.item, null); imageview image=(imageview)vi.findviewbyid(r.id.image); imageloader.displayimage(data[position], image); return vi; } and item.xml: <?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <progressbar android:layout_width="75dp" android:layout_height="7...

c - Count how many times one string appears in another one -

i've been more 3 hours trying solve problem, doesn't work 100%. please me. problem: create function receives 2 strings (a , b) , show number of times word of string b appears in a, without using function belong library. example: string a: house houuse househousehous string b: house it needs show word house appears 3x in string a. #include <stdio.h> #include <stdlib.h> #include <conio.h> #include <string.h> void count_string_b_a(char *a, char *b){ int i,j,k=0,size_a,size_b,equal=0,cont=0; size_a = strlen(a); size_b = strlen(b); j=0; for(i = 0; < size_b; i++){ for(j = 0; j < size_a; j++){ k=0; equal=0; for(k=0; k<size_b; k++){ if(a[j+k] == b[i+k]) equal++; if(equal==size_b) cont++; } } } printf("b %s appears %d times in %s",b,cont,a); } int main(){ int i; char a[40], b[10]; scanf("%[^\n]s",&a); getchar(...

jquery - dropdown close after 10 seconds -

i have problem. $(function () { $('.drop-down').click(function(e){ $('.nav-fixed').toggleclass('open'); e.stoppropagation(); }); }); i want when mouseout #nav.nav-fixed.open nav close after 10 seconds try $(function () { $('.drop-down').click(function(e){ cleartimeout($(this).data('cleartimer')) $('.nav-fixed').toggleclass('open'); e.stoppropagation(); }); $('.drop-down').mouseleave(function(){ var id = settimeout(function(){ $('.nav-fixed').removeclass('open'); }, 10000); $(this).data('cleartimer', id); }) }); demo: fiddle

gwt - how to stop firing unrelated event of event bus -

my problem how stop firing unrelated event of event bus. got this solution dialog box. not work in case of 1 instance initialize , try create new instance of same class. just example: below scroll panel has handler initialized. used document preview. class testscroll extends scrollpanel { public testscroll(){ } implemented onload() { // eventbus.addhandler code here. //here preview related code } unload() method { //eventbus remove handler code } } this preview has data contains links open different preview same class , different data structure, problem onunload ( which contains code of remove handler ) event not load , because other panel opened. not mean previous panel unload. in case, twice event handler registered. when 1 event fired other event fired. due that, preview 1 data shows properly, after preview2 opened , when close it...

clearRect text canvas html5 -

Image
i have canvas text added in <canvas id="canvasone" width="500" height="500"> browser not support html5 canvas. </canvas> javascript code: thecanvas = document.getelementbyid("canvasone"); var context = thecanvas.getcontext("2d"); var text = 'word'; context.font = '16pt calibri'; context.fillstyle = '#333'; var p0 = {x:x0,y:y0}; var word = {x:p0.x, y:p0.y, velocityx: 0, velocityy:0}; var lasttime = new date().gettime(); wraptext(context, text, p0.x, p0.y, maxwidth, lineheight); wraptext function(): function wraptext(context, text, x, y, maxwidth, lineheight) { var words = text.split(' '); var line = ''; for(var n = 0; n < words.length; n++) { var testline = line + words[n] + ' '; var metrics = context.measuretext(testline); var testwidth = metrics.width; if (testwidth...

sqlalchemy - Alembic Django Flask migrate database -

i have database shared between django , flask. in flask app, use sqlalchemy , use alembic migrate database. when migrate database , use command: $ alembic revision --autogenerate -m "some message" it automatically remove tables django had created: info [alembic.migration] context impl mysqlimpl. info [alembic.migration] assume non-transactional ddl. info [alembic.autogenerate] detected removed table u'django_content_type' info [alembic.autogenerate] detected removed table u'auth_group' info [alembic.autogenerate] detected removed table u'auth_user' info [alembic.autogenerate] detected removed table u'auth_user_groups' info [alembic.autogenerate] detected removed table u'django_session' info [alembic.autogenerate] detected removed table u'auth_permission' info [alembic.autogenerate] detected removed table u'auth_user_user_permissions' info [alembic.autogenerate] detected removed table u'account_u...

Rails Change record values -

i have record in postgresql of user status boolean , attributes "true" , "false". want show "true" "active , "false" "inactive". how do query or thing add in model. controller: def index @users = user.reorder("id asc").page(params[:page]).per_page(10) @count = 0 end model: class user < activerecord::base has_many :orders has_many :order_statuses attr_accessible :first_name, :last_name, :email, :password, :password_confirmation, :code validates :first_name, presence: true validates :last_name, presence: true valid_email_regex = /\a[\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i validates :email, presence: true, format: { with: valid_email_regex }, uniqueness: { case_sensitive: false } validates :password, length: { minimum: 6} has_secure_password before_save { self.email = email.downcase } before_create :create_remember_to...

perl - General check of missing semicolon -

as perl beginner getting compilation errors , have search lot find it. in end missing semicolon @ end of line. syntax errors missing semicolon checked perl not in general. there way check? edit: i know perl::critic can't use atm. , don't know if checks missing semicolon in general. because semicolons mean in perl , aren't there decoration, it's not possible tool (even perl interpreter itself) know in every case whether meant leave off semi-colon or not. thus, there's no general-case answer question; you'll need go through code , make sure it's correct. as mentioned in comments, there various tricks can try editor expedite process of finding potentially-incorrect lines; must, however, either examine , fix these hand or risk introducing new problems.

r - Subset variables in data frame based on column type -

i need subset data frame based on column type - example data frame 100 columns need keep column type factor or integer . i've written short function this, there simpler solution or built-in function or package on cran? my current solution variable names requested types: varlist <- function(df=null, vartypes=null) { type_function <- c("is.factor","is.integer","is.numeric","is.character","is.double","is.logical") names(type_function) <- c("factor","integer","numeric","character","double","logical") names(df)[as.logical(sapply(lapply(names(df), function(y) sapply(type_function[names(type_function) %in% vartypes], function(x) do.call(x,list(df[[y]])))),sum))] } the function varlist works follows: for every requested type , every column in data frame call "is.type" function sum tests every variable (boolean casted integer auto...

java - How to return all date of week -

i want return today's date , plus next 7 days. how manage this? i mean if today's date 31.07.2013 wednesday want returns 1.08.2013 thursday , on... try this calendar today = calendar.getinstance(); system.out.println(today.gettime()); today.add(calendar.date,1); system.out.println(today.gettime()); today.add(calendar.date,1); system.out.println(today.gettime());

iphone - I get didreceivememorywarning uitableview usuing AFNetworking to download the images? -

hello have uitableview use afnetworking load large images. when didreceivememorywarning hit app crashes. here code : in afnetworking+uiimageview.m have added suggested : @implementation afimagecache - (id)init { self = [super init]; if (self) { [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(didreceivememorywarning) name:uiapplicationdidreceivememorywarningnotification object:nil]; } return self; } - (void)didreceivememorywarning { debuglog(@"afnetworking did received memory warning "); [self removeallobjects]; } and code in uitableview follows : - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath touscell *tvcell; nsarray *nib; nib = [[nsbundle mainbundle] loadnibnamed:@...

How to call enlarge-window function depends on current window in Emacs -

i set keybinding following. (global-set-key [m-down] 'shrink-window) (global-set-key [m-up] 'enlarge-window) so m-up can enlarge-window , m-down otherwise. want enlarge window m-up if current window lower side. , if current window upper side m-up want call shrink-window function. likewise want shrink window m-down if current window lower side , enlarge if current window upper side. in other words, want indicate direction of window separator. how can write function? i finishing code answer came up. oh well. (require 'windmove) (global-set-key [m-up] (lambda() (interactive) (call-interactively (if (windmove-find-other-window 'up) 'enlarge-window 'shrink-window)))) (global-set-key [m-down] (lambda() (interactive) (call-interactively (if (not (windmove-find-othe...

mfc - CScrollBar paint when mouse moved over it -

scrollbar used in mfc gets highlighted (and changes color) when move mouse on it. want stop functionality. how can it? message gets triggered when mouse moved on scroll? first of not version of window changes color of scroll bar while mouse move. if notice not found feature in window xp. now strange why want change color of scrollbar not understand. but want what message gets triggered when mouse moved on scroll? its wm_ncmousemove message called when mouse move on scroll bar because scrollbar non client area. for more information on may referred link, mfc mdi issue : detecting mouse move on scroll bar

matlab - impixelinfo with value transformation -

i want display image , allow mouse on show pixel values- in impixelinfo function. thing is- show image on inverse scale (1./image) want shown values original ones. there way it? a possible workaround - puts original image on top transparent layer, leaving visible image (1./image) user , invisible image impixelinfo takes data from. imshow(1./image); hold on h = imshow(image); set(h, 'alphadata', zeros(size(image))); impixelinfo

ios - Displaying complex data in a UITableViewCell -

i have custom uitableviewcell class use display quite complex set of data. essentially cell displays match object. in doing displays information 2 teams , score, time elapsed , on. thinking mvc , clean code. should pass in match object , let cell everything? or better practise expose different elements of cell (team1namelabel, team1scorelabel, team2namelabel, etc...) , set them individually in uitableviewcontroller ? the first way makes uitableviewcontroller cleaner i'm relying on uitableviewcell "know" match class, team class etc... the second way makes more work uitableviewcontroller makes uitableviewcell "dumb" display. lay out information within cell. doesn't know information displaying. i follow these rules: the cell should have outlets displaying various bits of data. view should not contain logic. the controller should match data, parse , make calculations if necessary, , populate cell. controller, primary function...

c++ - smart pointers in multi-threaded envrionment -

i new smart pointers. however, have basic understanding of it. i've observed is necessary smart pointers destroyed in reverse order of creation or else smart pointers may misbehave. consider below situation: sharedptr<abc> my_ptr(new abc); //smart pointer created. instance counter = 1. func1(my_ptr); //copy constructor in smart pointer called. instance counter=2 func2(my_ptr); //copy constructor in smart pointer called. instance counter=3 func3(my_ptr); //copy constructor in smart pointer called. instance counter=4 now, isn't necessary func3() exits first followed func2() , func1() , my_ptr. question: if my_ptr goes out of scope first (& hence tries delete abc ), func1() , func2() , func3() still referring abc (through smart pointers) ? actually, observed wrong. the point of smart pointer remove responsibility of destroying object. means object delete when reference count reach 0: it doe...

apache - Error sending mail via local JamesServer -

i have problems sending email using james 3.0-beta4: i'm writing in scala. when transport.send @ moment occurred error. transport.send(message, externalrcpts.toarray(new address[externalrcpts.size()])); error james.domainlist - no domain found javax.persistence.noresultexception: query "select domain jamesdomain domain domain.name=:name" selected no result, expected unique result. @ org.apache.openjpa.persistence.queryimpl.getsingleresult(queryimpl.java:345) ~[openjpa-2.1.0.jar:2.1.0] @ org.apache.james.domainlist.jpa.jpadomainlist.containsdomain(jpadomainlist.java:100) ~[james-server-data-jpa-3.0-beta4.jar:3.0-beta4] @ org.apache.james.mailetcontainer.impl.jamesmailetcontext.islocalserver(jamesmailetcontext.java:341) [james-server-mailetcontainer-camel-3.0-beta4.jar:3.0-beta4] @ org.apache.james.transport.matchers.hostislocal.matchrecipient(hostislocal.java:38) [apache-standard-mailets-1.1.jar:1.1] @ org.apache.mailet.base.genericrecipientmatcher.match(gener...

c++ - What is the best free mobile development ide? -

i want try design mobile app cross compatible. computer science major , have experience in both c++, c#, , basic. have experience in html, css, php, , javascript. have ever made computer applications start developing mobile applications. start? xcode ios eclipse android visual studio windows mobile. you can use other ides ides mentioned above can find quite lot of support. planning build app c++ because if code can reuse of code android, ios , windows mobile. prefer code in java android unless extremely comfortable c++. because since said know c# java not different comparing c#.

sql server - Spring Batch Update: Insert only if does not exist otherwise update -

i need write batch update statement. able that. dont have primary key in table. there chances duplicate data sent database. want write batch update in such manner insert if data not exist. when data not exist, mean 3 columns of table can uniquely identify row. don't want make primary key using these 3 columns. there way can write batch update insert if data not exist otherwise update. have tried merge query not it. thanks you can use itemprocessor filter out duplicated items query, return null if item present in database: objects pass processor can written itemwriter , sure there not duplicated

php - What is the most effective way to translate string names from database in Laravel -

i building small social network language select. problem i'm clueless have user groups saved in database. id name 1 model 2 photographer 3 makeup artist i select these , place in signup form <div class="form-group"> {{ form::label('group', lang::get('auth.group'), array("class" => "col-lg-3 control-label ")) }} <div class="col-lg-8"> <select class="col-lg-12" name="group_id[]" id="" multiple size="6" > @foreach($groups $group) <option value="{{ $group->id }}">{{ $group->name }}</option> @endforeach </select> </div> </div> but i'm totally clueless how translate these, using laravel's localization . could please give me hint this? if want localize string come...

sql - Replacing a cursor with apply to loop through all tables in a database -

i have collection (100+) of tables of contain 2 fields rowchanged bit changedfields bit now, error has occurred leave entries rowchanged = 1 while changedfields empty. therefore need go through these , set rowchanged = 0 changedfields empty. i have achieved following cursor. begin transaction use databasename --database name clean declare @table_name varchar(50) declare @query varchar(250) declare table_cursor cursor select name sys.tables; declare @affected_rows integer = 0 open table_cursor fetch next table_cursor @table_name while @@fetch_status = 0 begin set @query = 'update '+@table_name+' set rowchanged = 0 rowchanged = 1 , (len(rtrim(convert(nvarchar(100), changedfields))) = 0 or changedfields null)' exec (@query) set @affected_rows = @affected_rows + coalesce(@@rowcount, 0) fetch next table_cursor @table_name end select @affected_rows affected_rows close table_cursor deallocate table_cursor rollback --change commit in order save...

Extract part of html with jQuery -

on alerting of these var htmldata = theparent.html(); i have getting result <!--<div id="megamenu_part2"> <div class="first_rowtitle" id="megamenu_part2-in"><h6><a href="/news/159">one is</a></h6> <div class="mochu_newstile"> <span><img src="images/megamenu-icon_01.png"></span><span class="viewnumber_countfirst2">250</span> <span><img src="images/megamenu-icon_line.png"></span> <span><img src="megamenu-icon_comment.png"></span><span>0</span> </div> </div>--> after use of jquery want html() of class = 'viewnumber_countfirst2' how can ?? var childht = $(htmldata).$('.viewnumber_count_sh').html() work???? try: var result = [] var htmldata = theparent.contents(); // return every...

html - How can I get this <h1> element to appear under the tables instead of to the right of it? -

i have html 2 horizontally aligned <tables> <h1> underneath. <h1> element isn't rendering correctly though; it's appearing right of tables instead of under them. how can appear under tables? this jsfiddle: http://jsfiddle.net/w3lwc/1/ and html reference: <div class="horizontal-div-container"> <div> <table> <tbody> <tr> <th >panel id:</th><th>100721651</th> </tr> <tr> <th >rfi points:</th><th>0</th> </tr> </tbody> </table> </div> <div> <table> <tbody> <tr> <th >panel id:</th><th>100721651</th> </tr> <tr> ...

Appending two strings to one index in an Array in Java -

i've fixed how want now. if else has same issue think easiest , efficient way of trying set deck of cards. can pick out individual cards using random variable in deck[random][0] , deck[random][1]. help, here code: public class newdeck { public static void main(string[] args) { string[] suits = new string[] { "clubs", "diamonds", "spades", "hearts" }; string[] faces = new string[] { "ace", "king", "queen", "jack" }; string[][] deck = new string[suits.length * (faces.length + 9)][2]; int = 0; (string y : suits) { (string x : faces) { deck[a][0] = x; deck[a][1] = y; a++; } } (string y : suits) { (int p = 2; p < 11; p++) { deck[a][1] = y; string pp = integer.tostring(p); deck[a][0] = pp; ...

android - Retrieving a large 32 bit unsigned integer from a Bluetooth low energy GATT characteristic -

i attempting retrieve large (potentially 2^32 - 1 ) unsigned 32 bit integer bluetooth 4.0 characteristic using getintvalue method of bluetoothgattcharacteristic instance. i passing format_uint32 getintvalue , because returns integer can't return number larger 2^31 - 1 . when try getting value larger 2^31 - 1 incorrectly returns negative integer. what's point of getintvalue accepting format_uint32 if can't possibly return unsigned 32 bit integer? there missing? is option use getvalue() , manually convert long ? looks works me: long value = characteristic.getintvalue(bluetoothgattcharacteristic.format_uint32, 0) & 0x00000000ffffffffl;

bitwise AND in java with operator "&" -

i read code following: byte[] bts = {8, 0, 0, 0}; if ((bts[i] & 0x01) == 0x01) does same thing if (bts[i] == 0x01) if not,what's difference between them? and first way trying here? no, doesn't. if(bts[i] == 0x01) means if bts[i] equal 1. if((bts[i] & 0x01) == 0x01) means if least significant bit of bts[i] equal 1. example. bts[i] = 9 //1001 in binary if(bts[i] == 0x01) //false if((bts[i] & 0x01) == 0x01) //true

reportlab - bad argument to internal function error in python -

i have python script uses reportlab create report, script has been tested , works expected on occasions following error message traceback info: file "c:\tools\legionellatool.py", line 605, in <module> createreport(selectedcoolingtowers, report_outputs_folder, dbo_colgis, openpdf) error info: ..\objects\moduleobject.c:50: bad argument internal function line 605 createreport(selectedcoolingtowers, report_outputs_folder, dbo_colgis, openpdf) createreport function ...creates report. have debugged through code , havent got errors, might make error appear, error happens on occasions whereas on other occasions report created fine. edit===== createreport code def createreport(myreporttable, myreportfolder, m3table, openpdf): global author global timestamp ## myreporttable = gp.getparameterastext(0) ## myreportfolder = gp.getparameterastext(1) ## m3table = gp.getparameterastext(2) ## openpdf = gp.getparameterastext(3) author = getpas...

jquery - Setting up different droppable area in one canvas HTML5 -

i want have different droppable area in 1 canvas, example can seen on link http://custom.case-mate.com/diy?bypasslandingpage=true#design/iphone5_barelythere want drag , drop images on different portions of same canvas. after checking link, can tell me how have done this? what first define regions in array want use drop zones locally on canvas. from there check mouse client position receive in drop event adjusted canvas: /// random regions check against regions = [[0, 0, 100, 100], [120, 50, 100, 100], [30, 230, 100, 100], [300,300,100,100]], /// used adjust mouse pos. later rect = canvas.getboundingclientrect(), ... setup canvas handle drop events: canvas.addeventlistener('dragover', filedragover, false); canvas.addeventlistener('drop', fileselect, false); when drop files canvas can check - here draw random fill color region file(s) dropped @ (if any): function fileselect(e) { e.stoppropagation()...

objective c - How do i implement Drag and drop with NSOutlineVIew -

i have 2 nstableviews on screen; want drag row 1 table other table. see lots of tips here , there not see complete example , i'm bit confused. saw examples totally different apples sample apps tableview playground , drag , drop outlineview . i decided use apples method, im stuck. tableview playground implement these methods in model object. - (nsarray *)writabletypesforpasteboard:(nspasteboard *)pasteboard - (id)pasteboardpropertylistfortype:(nsstring *)type - (nspasteboardwritingoptions)writingoptionsfortype:(nsstring *)type pasteboard:(nspasteboard *)pasteboard i dont understand how set these up. 1st method returned array string @"com.mycompany.myapp.mypasteboardtype" as suggested in this question. what should put 2nd method? model custom object has number of strings, arrays, , dictionary variables. not understand 3rd method. wish there example see simple drag 1 table custom model object. edit: implementation based on response below -(id)pasteboar...

php - SPARQL query to get all parent of a node -

i have tables in mysql database like: +-------+------------+-------------+-----------+ | id | subject | predicate | object | +-------+------------+-------------+-----------+ | 1 | atm | subclassof | network | +-------+------------+-------------+-----------+ | 2 | arpanet | subclassof | network | +-------+------------+-------------+-----------+ | 3 | network | subclassof | main | +-------+------------+-------------+-----------+ | 5 | software | subclassof | main | +-------+------------+-------------+-----------+ | 7 | linux | subclassof | software | +-------+------------+-------------+-----------+ | 8 | windows | subclassof | software | +-------+------------+-------------+-----------+ | 12 | xp | subclassof | windows | +-------+------------+-------------+-----------+ | 13 | win7 | subclassof | windows | +-------+------------+-------------+-----------+ | 14 | win8 |...

c# - display an image in a form when the image name is selected -

new wpf. want display image in form when image name selected combo box (image stored in sql database fills combo). would know of example how can done. have added code populates text boxes when selecting combo. private void comboboxdisplay_selectionchanged(object sender, selectionchangedeventargs e) { string constring = "data source=tcp:****;initial catalog=******;persist security info=true;user id=*******;password=******"; string query = "select * tables name='" + comboboxdisplay.selecteditem.tostring() + "' ;"; sqlconnection condatabase = new sqlconnection(constring); sqlcommand cmddatabase = new sqlcommand(query, condatabase); sqldatareader myreader; try { condatabase.open(); myreader = cmddatabase.executereader(); while (myreader.read()) { string sreid = myreader.getint32(0).tostring(); st...

c# - VDProj directory has no write access after installation -

i have vdproj project use create setup program application. i've had install visual studio 2010 (on machine) allow me run this, has been removed vs2012.. annoying.. that's different thread. when end user installs program, creates files in c:\program files\mycompany\ folder, inherits security parent directory, has no write access user. the problem is, when program runs, creates log files, , software update if required. application requires write access directory. i'm guessing install software 'mydocuments' folder, or folder has write access, wondering if there's better way of doing this? when program needs write protected locations program files, can launch using shellexecute functionality , runas verb/operation. trigger consent dialog uac require administrator give permission elevation. annoying if happens often, when necessary.

laravel 500 internal server error -

i'm trying deploy laravel 4 app on 1and1 shared hosting, keep getting 500 internal server error. i have checked following: using php 5.4 mcrypt php extension installed chmod 777 /app/storage/ domain pointing /laravel/public/ i'm out of ideas now? one thing i've noticed if go /index.php/, "fatal error: require(): failed opening required" error. mean of paths wrong somewhere? doubt it, because app working fine locally. any amazing. thanks try running composer install after cloning repo. vendor directory in laravel .gitignore file default. edit: re-read follow-up comment , realized shouldn't attempt answer questions after midnight.

java - Reading, parsing and sorting data from a CSV file -

i need read in csv file, parse , sort value according these parameter: the top 10 selling products the top performing branches the worst performing branches the employee took sales here code far, advice on how sort it? import java.io.*; public class csv { public static void main(string[] args) throws ioexception { try (bufferedreader csvfile = new bufferedreader(new filereader("/k:/connexicawork/data/data.csv"))) { string[] dataarray = null; string data = csvfile.readline(); // read first line. while (data != null) { data = data.replace(",00", ".00"); dataarray = data.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)"); //split on comma if comma has zero, or number of quotes in ahead of it. (string item : dataarray) { system.out.print(dataarray[34] + " # "); } system.out.println(); // print data line. ...

sql - squeryl: how to use oneToMany relation for constructing queries -

i have liftweb application in use record/squeryl orm framework. here schema: object appschema extends schema { import org.squeryl.dsl.onetomanyrelation val groups = table[group]("groups") val domains = table[domain]("domains") val grouptodomains = onetomanyrelation(groups, domains). via((g, d) => g.id === d.groupid) } object group extends group metarecord[group] loggable { } class group extends record[group] keyedrecord[long] loggable { override def meta = group @column(name = "id") override val idfield = new longfield(this) val name = new stringfield(this, 700, "") @column(name = "date_added") val createdat = new datetimefield(this) lazy val domains: onetomany[domain] = appschema.grouptodomains.left(this) } object domain extends domain metarecord[domain] loggable { } class domain extends record[domain] keyedrecord[long] { override def meta = domain @column(name = "id") overri...

php - Find days difference between two dates with range of thousands of year -

how can find days difference in php dates may 1/1/1 1/1/1000000. strtotime(), mktime(), date->diff() these function not helpful more limit of unix timestamp. as far know, datetime allows dates in periods of time. before unix. quite possibly fial on 1/1/10000000 needs testing. to difference, use diff $datetime1 = new datetime('2009-10-11'); $datetime2 = new datetime('2009-10-13'); $interval = $datetime1->diff($datetime2); echo $interval->format('%r%a days'); if diff doesn't work on ranges, try https://stackoverflow.com/a/676828/486780 .