Posts

Showing posts from March, 2013

java - Complete first method before starting 2nd -

my issue here in these line : @override public void onclick(view arg0) { dofirstmethod(); dosecondmethod(); } the problem don't know how program 2nd method before 1st finished. there way in java start 2nd method after 1st finished thought delaying 2nd method , after few seconds realized 1st methods speed on every mobile device different. use handler or thread @override public void onclick(view arg0) { dofirstmethod(); } public void dofirstmethod { ..... ..... dosecondmethod(); }

sql - How to use the date from a FileName and use this date in an expression - SSIS Package -

i quite beginner ssis packages bear me. trying do: i have daily files in format of yyyy-mm-dd_filename_bla_bla.tsv date of file need added in table trying import it. doing manually derived coloumn expression: (dt_date)(dt_dbdate)"yyyy-mm-dd" is there possibility automatically take file name , take date part import table. the things find on internet getting date file name, opposite. i hope provided enough information, , can me out problem. thanks in advance. if know file name keep file name in variable example let file name : 01/02/2015_kjh.bgd then using derived column use string functions left(@variable,10) 10-> length of date then map oledb destination

logarithm - MATLAB semilog scaling -

i'm new matlab, , working on program deals frequency of human voice based on microphone input. biggest problem running musical notes (what dealing in project) increase in frequency exponentially, 1.059463^x each semitone in musical scale. in program dealing with, need both scale graph detected frequency close note number corresponds scale data can work note numbers in terms of notes , musical cents frequency graph can converted midi data. other option have found has been create library of frequencies recorded frequencies compared to, unnecessarily complicated , time consuming. so, in essence, trying scale data a2, frequency of 110hz, correspond note number 45. there way this? i think want: f = 110; %// frequency in hz n = log10(f/440)/log10(2)*12+69; %// 440 hz (note a4) note 69 note = round(n); cents = round((n-note)*100); examples: f = 110 gives note = 45 cents = 0 f = 345 gives note = 65 cents = -21 in accordance this reference , th

linux - Environment variable with spaces in a string - How to use them from /proc/pid/environ -

i set variable spaces in string new bash: var='my variable spaces' /bin/bash and if want start new bash same environment, like: env=$(cat /proc/self/environ | xargs -0 | grep =) env -i - $env /bin/bash but thing is, in /proc/self/environ , variable without quotes. last command throws a: env: variable: no such file or directory how can work around limitation? ps: simplified version of following issue: https://github.com/jpetazzo/nsenter/issues/62 i think answer here not use shell script set things up. using higher-level language makes easier parse /proc/<pid>/environ useful. here's short example: #!/usr/bin/python import os import sys import argparse def parse_args(): p = argparse.argumentparser() p.add_argument('pid') p.add_argument('command', nargs=argparse.remainder) return p.parse_args() def main(): args = parse_args() env = {} open('/proc/%s/environ' % args.pid) fd: env

html - Wordpress Template CSS issues -

i have modified website template colour has changed. the wordpress template uses .less files default settings admin panel when changing settings , saving console style.css file rewritten. i modified style.css file , use couldn't find of css code in .less files. after changing colours in style.css file of active items change colour on mouse roll on or off , change white result on disappearing on white background. problem can't find location in code change these!! have attempted examining elements in browser, following file locations , names, searching colour codes too. what best way find them? thank you. you need change css .btn then. try adding custom css inside template settings page , add !important rules apply. the magnifying glass class .btn work of buttons. i guess don't want border-bottom: red property!

SAS and line pointers in a loop -

data test; infile datalines; input k1 k2 k3 k4 k5 k6 k7 k8 k9 k10; array a(*) k1-k10; i=1 10; if a(i) eq . stop; line=a(i); input #line k1 k2 k3 k4 k5 k6 k7 k8 k9 k10; output; end; stop; datalines; 5 9 2 4 6 3 . . . . 29 57 32 9 2 29 2 0 23 1 83 34 28 1 43 3 24 2 6 2 0 84 62 75 3 52 65 1 5 2 0 2 12 45 92 3 60 24 6 2 47 24 87 2 52 36 1 17 3 1 90 93 2 1 40 20 75 2 5 14 78 27 27 2 4 1 12 21 4 2 21 40 3 21 3 19 3 2 4 2 84 2 5 3 13 6 23 98 1 2 ; run; i want read observations numbers in first row. expected result: 0 2 12 45 92 3 60 24 6 2 21 40 3 21 3 19 3 2 4 2 29 57 32 9 2 29 2 0 23 1 0 84 62 75 3 52 65 1 5 2 47 24 87 2 52 36 1 17 3 1 83 34 28 1 43 3 24 2 6 2 the error after running code: error: old line 3387 wanted sas @ line 3391. use: infile n=x; , suitable value of x. rule: ----+----1----+----2-

php - Varnish does not cache multiple wordpress -

i have setup varnish on high end dedicated server whm running around 10-13 websites, on wordpress. i'm seeing hit rate low , miss rate high in "varnishhist". also, when varnishtop -i txurl , see "/" url (and not each website url) being requested apache @ higher rate. below excerpt: 4.02 txurl / 1.00 txurl /wp-content/uploads/2014/12/034kj343.jpg 0.96 txurl /wp-content/uploads/2014/12/dfkkj30434.jpg 0.96 txurl /wp-content/uploads/2014/10/3403402022.jpg i believe varnish must cache home page of every single site , send client rather requesting backend. suggestions please? ok. managed find solution. here current vcl file works good. sub vcl_recv{ if (req.http.cookie && req.http.cookie ~ "(wordpress_|phpsessid)") { return(pass); } if (req.url ~ "wp-admin|wp-login") { return (pass); } else{ unset req.http.cookie; } #since can not unset all, leave wp-admin } sub vcl_backend_response

ios - Update CoreData Objects with NSFetchedResultsController -

i made app uses core data , fetched results controller. i can add coredata objects , delete them. want update coredata object via fetched results controller. know have fetch objects , can change it. because i'm still learning don't know how this. i'd ask how this? when fetch coredata, if modify results update actual value within coredata when save it. you'll want first perform fetch: nsfetchrequest *request = [[nsfetchrequest alloc] init]; [request setentity:[nsentitydescription entityforname:@"entity" inmanagedobejctcontext:moc]]; nserror *error = nil; nsarray *results = [moc executefetchrequest:request error:&error]; // error handling code once have results, can modify individual records... myentity *entity = [results objectatindex:0]; entity.title = @"updated attribute"; // save context [moc save:&error]; edit: in swift, along lines of following: let appdelegate = uiapplication.sharedapplication().delegate appde

Non ascii characters in URL param in camel -

i using graph api of facebook , call through camel framework. query has non ascii characters (e.g. küçük). getting following exception:- cause: org.apache.commons.httpclient.uriexception: invalid query @ org.apache.commons.httpclient.uri.parseurireference(uri.java:2049) @ org.apache.commons.httpclient.uri.<init>(uri.java:147) @ org.apache.commons.httpclient.httpmethodbase.geturi @ org.apache.commons.httpclient.httpclient.executemethod @ org.apache.commons.httpclient.httpclient.executemethod @ org.apache.camel.component.http.httpproducer.executemethod @ org.apache.camel.component.http.httpproducer.process @ org.apache.camel.util.asyncprocessorconverterhelper$processortoasyncprocessorbridge.process(asyncprocessorconverterhelper.java:61) @ org.apache.camel.util.asyncprocessorhelper.process(asyncprocessorhelper.java:73) @ org.apache.camel.processor.sendprocessor$2.doinasyncproducer(sendprocessor.java:122) does camel support non ascii characters in uri? if not, other things c

timeout - Close pop up and refresh parent page javascript -

i want close pop , refresh parent after few seconds delay make sure data received. have following function closeandrefresh(){ settimeout(function() { window.open('/{!currsubid}','_top'); window.location = window.location.href; return true; },5000)} this code refreshes parent inside popup, pop not close, rather parent shows refreshed - in pop up so move pop outside of timeout, give name, call close, , reload. function closeandrefresh(){ var winpop = window.open('/{!currsubid}','_top'); //load pop give name window.settimeout(function(){ winpop.close(); //close pop window.location.reload(true); //refresh current page },5000); } you use ajax call server , not have deal pop , wondering if pop blocker block or not knowing if call completetd. when call comes call, can reload page.

Concatenation of a variant number of keys of a dictionary Python (recursion?) -

hello stackoverlow members, i'm trying concatenate keys (string) on hand, , values (list) on other hand, of dictionnary. for better understanding, here have @ beginning: dict = {'bk1': {'k11': ['a1', 'b1', 'c1'], 'k12': ['a2', 'b2', 'c2']}, 'bk2': {'k21': ['d1', 'e1'], 'k22': ['d2', 'e2'], 'k23': ['d3', 'e3']}, 'bk3': {'k31': ['f1', 'g1', 'h1'], 'k32': ['f2', 'g2', 'h2']} } and here @ end: newdict = {'k11_k21_k31': ['a1', 'b1', 'c1', 'd1', 'e1', 'f1', 'g1', 'h1'], 'k11_k21_k32': ['a1', 'b1', 'c1', 'd1', 'e1',

regex - Get Value from string between ":" and "," -

here example of string "{"id":128,"order":128,"active":"1","name":"\" now need "128" - id parameter. first value between ":" , ",". i have tried preg_match , different regular expressions i'm not in regular expressions. maybe knew how make ? $id = preg_match('/:(,*?)\,/s', $content, $matches); here sample code number after first : using regex: $re = "/(?<=\\:)[0-9]+/"; $str = "\"{\"id\":128,\"order\":128,\"active\":\"1\",\"name\":\"\""; preg_match($re, $str, $matches); print $matches[0]; here sample program on tutorialspoint . just small detail regex (?<=\\:)[0-9]+ : uses fixed-width look-behind php supports , fortunately.

css - How do I get this code to center a div id? -

#border-search { position: relative; display: block; margin-left: 10px auto !important; margin-right: 10px auto !important; width: 100% !important; } here js fiddle https://jsfiddle.net/matsuiny2004/7dms170p/ add text-align:center; css. here fiddle https://jsfiddle.net/7dms170p/2/

c++ - Synchronizing mutiple processes in C with shared memory -

i have program creates child processes in loop fork(). child create other processes well. all processes must increment count, , count must displayed @ end. to used simple locking system. shared memory of size 2. there 2 variable of type sig_tomic_t: count , lock. when process wants increment count sets lock 1, increments count, sets lock 0. otherwise, if lock 1, process sleeps. here code segment of interest. for(i = 1; <= 10; i++) { if((pid = fork()) < 0) { perror("error fork!"); exit(2); } if(*lock == 0) { *lock = 1; *count = *count + 1; *lock = 0; } else { while(*lock == 1) { sleep(1); } } } the problem though used simple locking system, count isn't incremented correctly.

c# - ASP.NET Windows Authentication Login screen -

i have ipad app , looking add authentication it. have login page username , password field in app. now able send username , password asp.net api. looking take username , password , authenticate user windows authentication login. after login, able authenticate them before (i.e. run query) i found article: http://geekswithblogs.net/manjunath.k/archive/2014/09/23/windows-authentication-in-asp.net-web-application.aspx it appears wanna this: var user = username; (username comes app) if(user.isinrole(windowsbuiltinrole.administrator)){ //user exists } but how authenticate password ? confused.

java - Difference between LinkedList of Object and a LinkedList of a HashMap? -

i coding java code , saw couldn't : linkedlist<hashmap<string,object>> errormanagement = new linkedlist<hashmap<string, object>>(); hashmap<string,object> = new hashmap<string,object>(); errormanagement.add(i.clone()); <-- impossible add hash map here where getting errors if wanted add hash map linked list ... and figured out doing in way: hashmap<string,object> tokeninfo = new hashmap<string,object>(); linkedlist<object> errormanagement = new linkedlist<object>(); errormanagement.add(tokeninfo.clone()); <-- working charm ! i hadn't more errors. may explain me why ? , what's difference ? p.s. : should ,before asks me, error thrown when adding linked list (for first example)! the problem return type of clone() : it's object , not hashmap<string,object> . that's why second snippet works, first 1 not. you can fix first code snippet constructing copy of hash map through co

eclipse - Cannot access MSSQL using web service(Exception: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver) -

i have created basic web service using eclipse access 1 of databases , run simple query. when create web service in eclipse , test client, returns me exception exception: java.lang.classnotfoundexception: com.microsoft.sqlserver.jdbc.sqlserverdriver i have done following: use same code in different independent java class , runs fine. database return results. no exceptions. i have added classpath in eclipse runtime when creating web service (as did when tested step 1 above). this sample code in eclipse wrote , generate webservice from: package testservice; import java.sql.*; import javax.jws.webservice; @webservice public class testserv { public string testsql() throws sqlexception, classnotfoundexception{ string answer = "ok"; class.forname("com.microsoft.sqlserver.jdbc.sqlserverdriver"); connection conn = drivermanager.getconnection ("jdbc:sqlserver://192.168.69.207;

java - Could not find or load main class testABCD -

i have create 1 java application , import selenium server standalone jar class name abc in side calss 1 testing program open firefox browser, athor task... also have run configuration , run give error main class not fount import java.util.regex.pattern; import java.util.concurrent.timeunit; import org.junit.*; import static org.junit.assert.*; import static org.hamcrest.corematchers.*; import org.openqa.selenium.*; import org.openqa.selenium.firefox.firefoxdriver; import org.openqa.selenium.support.ui.select; public class abc { private webdriver driver; private string baseurl; private boolean acceptnextalert = true; private stringbuffer verificationerrors = new stringbuffer(); @before public void setup() throws exception { driver = new firefoxdriver(); baseurl = "https://www.google.co.in/"; driver.manage().timeouts().implicitlywait(30, timeunit.seconds); } @test public void testabcd() throws exception { driver.get(baseurl + "a

Can a vector class in C++ be used like a Dictionary class in C#? -

can vector class in c++ used dictionary class in c#? can have vector class store classes of same type. member of class can regarded key , remaining members can thought of data. no, vector class in general won't stay sorted when add members. means can't efficiently find items in it, need linear scan. use std::unordered_map key-value container offer o(1) key lookup.

manage logstash from Java -

i want manage starting , stopping of logstash java. there easy/nice way this? so, can give me example of how start logstash without needing logstash instance started run.bat manually.? you can run batch file process in java this string cmd = "cmd /c start c:\\path\\to\\run.bat"; process logstashprocess = runtime.getruntime().exec(cmd); and kill process calling destroy() method when needed logstashprocess.destroy(); you can add these startup , shutdown hooks of application (the application log analyzing using logstash) or write standalone java app maintain starting , stopping logstash.

java - Eclipse can't start Tomcat with option : takes control of Tomcat installation -

Image
i using ubuntu 14.04 , eclipse luna. work eclipse , tomcat followed steps. 1) installed tomcat using : sudo apt-get install tomcat7 2) eclipse tomcat start , stop works fine below image radio button 1 option (double click server in eclipse). option 1 browser find 404 visit http://localhost:8080/ 3) apply option 2 :use tomcat installation(take control of tomcat installation) like image below it not start server radio option 2. when tried start server find error this i have tried find solution link . applied not worked me. <workspace-directory>\.metadata\.plugins\org.eclipse.core.resources also tried apply link , changed port. not worked. also executed option : cd~/workspaceeclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings rm org.eclipse.wst.server.core.prefs rm org.eclipse.jst.server.tomcat.core.prefs rm org.eclipse.jst.server.tomcat.core.prefs rm org.eclipse.wst.server.core.prefs cd /usr/share/tomcat7 sudo service tomcat7 stop sud

assembly - The address of the "call" instruction's location -

i think "call" instruction kind of "jump" instruction. "jump" instruction have address go. , "call" instruction either should have target address. when disassemble binary, "call" instruction have lable of target function. then, how know go? in other words, can found target address of each function? x86, arm whatever. the addresses in assembly programming labeled symbolic names. , true not call instruction other instructions. there reason approach - addresses depend on in memory program loaded. also, instructions contains not address itself, offset, relative current address program executed. on other hand, programmer doesn't care exact value of address. want know address placed. why symbolic labels used. using symbolic labels meaningful names improves readability of source code , makes program easy support , extending. these symbolic addresses (labels) translated numbers during assembling of source code executabl

C# Azure Storage Blob Upload TransactionScope -

is there somewhere class allow roll transactionscope on azure blockblob actions ? i make works: cloudblockblob blockblob; private void uploadpicture(stream istream) { using(var ts = new transactionscope()) { blockblob.uploadfromstream(istream); throw new exception(); ts.complete(); } } when exception raise, uploaded file not cancelled. if not possible transaction scope, how should proceed ? azure storage client library not provide support. if, however, cancellation support acceptable scenario, can use uploadfromstreamasync api cancellationtoken . while asynchronously uploading blob, can cancel operation. depending on operation's current progress, try abort upload.

javascript - .on('click') only works once -

this question has answer here: why jquery or dom method such getelementbyid not find element? 6 answers i'm trying fill div different color tiles, have html <div id="field"> , , following javascript code: // want field globally accessible var field; var colors; $(document).ready(function(){ field = [[],[],[],[],[],[],[],[],[]]; colors =["black","yellow","blue","green","grey","brown"]; fillfield(); $(".tile").on('click', function(){ console.log("sfadfd"); var x = this.getattribute("data-x"); var y = this.getattribute("data-y"); console.log("x: "+x+", y: "+y); tileclicked(x,y); }); }); var tileclicked = function(x,y){ console.log(colors[field[y][x]]); field[y][x] = 0; showfield(); }; // di

Override a style in Android without modifying layout file -

my experience until when dealing styles has been create style.xml file , create properties want style. if want style based on existing style, use parent attribute. specify style inside of layout file on controls want apply style to. where @ loss when want use system styles , update properties. wondering whether can leave layout files alone , not bother applying styles controls. instead, somehow update property of system style , update everywhere in app style being used default. more specifically, want change background color of actionbar haven't found way of doing other way described above. you're looking themes, collections of styles, applied either globally throughout application, or each activity in particular. start this document , investigate further.

php - Set the zoom level for the html file generated using PHPExcel? -

i trying generate html file using phpexcel. have more 30 columns , zoom page. i've tried using code below, hasn't worked. $objphpexcel->getactivesheet()->getpagesetup()->setfittopage(true); $objphpexcel->getactivesheet()->getpagesetup()->setfittowidth(2); i've tried using this, hasn't worked either. $objphpexcel->getactivesheet()->getsheetview()->setzoomscale(250); both options don't work in case of html page, zoom works if excel file. going wrong? as may see chaining of commands, setzoomscale() method part of worksheet class , have impact in case worksheet written, not when read. the phpdoc phpexcel lists internal command _writesheetviews() excel2007 writer , _storezoom old excel versions whereas phpexcel_writer_html doesn't offer similar behavior. what may try adding custom css styling created html file may use smaller font-sizes table. afaik won't able change zoom level of browser programmatically

textview - issue with my first android app -

before posting question , wanna clarify first post on stackoverflow , let's story beggin. as title said , i'm making first app on android , found myself blocked issue . there 3 button on app : button1 : give textview2 "hello world again " , make visible // button2 : make textview2 invisible // button3 : make textview1 invisible this code freom main_activity : package com.example.ismail.app_test_1; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; public class mainactivity extends actionbaractivity { button button_aff; button button_hide; button button_hide_hw; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button_aff = (button) findviewbyid(r.id.button)

sql server 2008 r2 - How do I transpose multiple rows to columns in SQL -

my first time reading question on here. i working @ university , have table of student ids , supervisors, of students have 1 supervisor , have 2 or 3 depending on subject. the table looks this id supervisor 1 john doe 2 peter jones 2 sarah jones 3 peter jones 3 sarah jones 4 stephen davies 4 peter jones 4 sarah jones 5 john doe i want create view turns this: id supervisor 1 supervisor 2 supervisor 3 1 john doe 2 peter jones sarah jones 3 peter jones sarah jones 4 stephen davies peter jones sarah jones 5 john doe i have looked @ pivot functions, don't think matches needs. any appreciated. pivot right clue, needs little 'extra' :) declare @tt table (id int,supervisor varchar(128)); insert @tt(id,supervisor) values (1,'john doe'), (2,'peter jones'), (2,'sarah jones'), (3,'peter jones'), (3,'sarah jones'), (4,'stephen davies'), (4,'

c# - Taking over a DotNetNuke website. Getting errors -

the project saved website. vpning server , opening machine. when trying build getting 60 errors (all same). class.property.get must declare body because not marked abstract or extern class.property.set must declare body because not marked abstract or extern i spent hours yesterday going through many questions reported same error , kept leading more , different errors. figured perhaps maybe lack of knowledge on dotnetnuke , reset scratch in hopes maybe recognize have went wrong. this 1 of properties reporting error (15 in total each get;set) public int creditscore{ get; set; } i open vs click file - open - website , give path website on vpn. opens in vs fine. my page properties project are: (if other info valuable here let me know) .net framework 2.0 i've never worked dotnetnuke before hoping there configuration issues need make , build fine. the code written in version of .net allowed: public int someproperty { get; set; } (.net 3.5 or 4.0?)

ios - UISearchController does not trigger delegate methods and search bar delegate methods -

so have uisearchcontroller, shows bar, can enter text not trigger delegate methods. here code: @ibaction func searchtapped(anyobject) { nslog("search...") let cancelbutton = uibarbuttonitem(image: uiimage(named: "delete_sign-50"), landscapeimagephone: nil, style: .plain, target: self, action: "canceltapped:") var searchcontroller = uisearchcontroller(searchresultscontroller: nil) searchcontroller.dimsbackgroundduringpresentation = false searchcontroller.searchbar.placeholder = "enter text search" searchcontroller.searchresultsupdater = self; searchcontroller.hidesnavigationbarduringpresentation = false searchcontroller.delegate = self searchcontroller.searchbar.delegate = self self.definespresentationcontext = true; uiview.animatewithduration(0.2, animations: { () -> void in self.navigationitem.rightbarbuttonitems = nil self.navigationitem.rightbarbuttonitems = [cancelbut

batch file - Xampp: Open Apache and MySQL, then Webbrowser -

i need 1 .bat-file which... start xampp apache start xampp mysql-server wait until step 1 , 2 finished open webbrowser , navigate localhost i tryed combine .bat-files xampp-folder, it's stopping @ apache 2 starting ... here file: @echo off cd /d %~dp0 echo please close command shutdown echo apache 2 starting ... apache\bin\httpd.exe cd /d %~dp0 echo please dont close window while mysql running echo mysql trying start echo please wait ... echo mysql starting mysql\bin\my.ini (console) mysql\bin\mysqld --defaults-file=mysql\bin\my.ini --standalone --console "c:\program files (x86)\google\chrome\application\chrome.exe" sleep1 start "localhost" "http://localhost" i'm not expert batch files example wrote myself. launches xampp control-panel ( can configured auto start apache , mysql modules ), browser , editor ( firefox , notepad++ example ). if xampp started same programs closed. @echo off tasklist /fi "imagename

richfaces - rich:fileupload in rich:popupPanel fails first time, in a large page -

i have rich:datatable , bunch of buttons @ bottom of xhtml. use 1 of buttons show rich:popuppanel upload file. separated rich:popuppanel rich:fileupload different forms based on earlier suggestions. 1st form: <h:form id="form" enctype="multipart/form-data"> <h:panelgrid columns="1" columnclasses="valign"> <rich:messages/> <rich:panel style="width:1100px;"> <f:facet name="header"> <h:outputtext value="mrm segments" /> </f:facet> <rich:datatable value="#{couponcontroller.campaignsegmentdtolist}" var="campaignsegment" id="sas" rowclasses="odd-row, even-row" styleclass="stable" sortmode="single" rowkeyvar="myrow" onrowclick="myfunction()"> &l

function - Error instantiating a class in Python -

i'm attempting instantiate class: class customer(object): def __init__(self, name, money, ownership): self.name = name self.money = money self.ownership = ownership def can_afford(self): x = false bike in bikes.values(): if self.money >= bike.money * margin: print "customer {} can afford {}".format(self.name, bike) x = true if not x: print "customer {} cannot afford bikes @ time.".format(self.name) shoppers = { # initial condition of shopper1 "jane": customer("jane", 200, false), # initial condition of shopper2 "alfred": customer("alfred", 500, false), # initial condition of shopper3 "taylor": customer("taylor", 1000, false) } buyer = customer(name, money, ownership) but buyer = customer(name, money, ownership) keeps getting errored: undefined

c# - Clon canvas to dynamic viewbox WPF -

having main window , canvas class graphcontext animations , several shapes interact like: xaml <dockpanel name="stackpanel2" dockpanel.dock="left" margin="10,10,10,10" lastchildfill="true" > <myctrl:graphcontext x:name="graphsurface" background="black" > </myctrl:graphcontext> </dockpanel> code public class graphcontext : canvas { ellipse _fixedcircle; internal int cavaswidth { get; set; } internal int cavasheight { get; set; } public void drawsinglepoint(solidcolorbrush color) { this.children.clear(); _fixedcircle = new ellipse(); _fixedcircle.width = 25; _fixedcircle.height = 25; _fixedcircle.stroke = color; _fixedcircle.fill = color; _fixedcircle.strokethickness = 3; // center x , y coordinates double x = this.actualwidth /

python - Why is os.rename program not sorting directory -

i have program trying write take large directory (10,000+files inside) , create new sub directories break large directory smaller chunks (of approximately 100 files each).the program have raises no errors when call in terminal, not sort large file... think problem os.rename() dont understand why tried shutil.move() , still had same problem. sorry couldent make code appear in color new site #!/usr/bin/python import os import glob import sys functools import partial sys.setrecursionlimit(1000) def mk_osdict(a): #os.chdir(a) #grouping files .mol2 endings os_list =glob.glob("*.mol2") #making dictionary list of files in directory os_dict = dict([i,n] i,n in zip(range(len(os_list)),os_list)) return os_dict dict_os = mk_osdict("decoys") #function sort files new directories specific size. def init_path(f): block = (len(f)/100)+1 #i_lst gives list of number of entries i_lst = [str(i) in range(block)] '''paths

sql - Why is Data Not Saved to the Database in my Guestbook Application? -

i creating application requires guestbook.. data database appears on website data enter website doesn't automatically put database. here code have.. protected sub butsign_click(sender object, e eventargs) handles butsign.click dim strdsn string = "provider=microsoft.jet.oledb.4.0;" & " data source=c:\users\shauna watson\desktop\project copies\final\app_data\factory.mdf" dim strsql string = (((("insert guestbook " & "( name,address,email,comments)" & "values ('") + txtname.text.tostring() & " ',' ") + txtaddress.text.tostring() & " ', '") + txtemail.text.tostring() & " ',' ") + txtcomments.text.tostring() & " ')" ' set access connection , select strings ' create oledbdataadapter dim myconn new oledbconnection(strdsn) 'create ole db command , call executenonquery execute ' sql st

php - Parsing date error -

i have strange error dont understand. reason, dates not parsed. the code: $day = strtotime($_get['d']."-".$_get['m']."-".$_get['y']); $datetimezone = new datetimezone("europe/prague"); $datetime = new datetime($day, $datetimezone); $offset = ($datetimezone->getoffset($datetime))/3600; now weird thing is.... if pass in numbers, works, doesnt others... for example url work: d=15&m=12&y=2014 but this: d=12&m=12&y=2014 shows fatal error: uncaught exception 'exception' message 'datetime::__construct(): failed parse time string (1418252400) @ position 7 (4): unexpected character' in i have tried experimenting it, changing format of strtotime, no luck , seems randomly working.... when sending timestamp parameter of datetime object, have use @ symbol prefix. see manual (unix timestamp): http://php.net/manual/en/datetime.formats.compound.php so, correct way is: $da

nullpointerexception - UCanAccess driver throws Exception when trying to connect with Access database while Jackcess connection works fine -

1) ucanaccess sample code works database (access 2000) class.forname("net.ucanaccess.jdbc.ucanaccessdriver"); connection conn = drivermanager.getconnection(database_url); system.out.println(conn); 2) same ucanaccess sample code not work database b (access 2000) , leads exception stack trace: net.ucanaccess.jdbc.ucanaccesssqlexception @ net.ucanaccess.jdbc.ucanaccessdriver.connect(ucanaccessdriver.java:247) @ java.sql.drivermanager.getconnection(drivermanager.java:571) @ java.sql.drivermanager.getconnection(drivermanager.java:233) @ xxxxxxxxxx.jdbcaccessconnection.main(jdbcaccessconnection.java:23) caused by: java.lang.nullpointerexception @ net.ucanaccess.converters.ucanaccesstable.getindexes(ucanaccesstable.java:74) @ net.ucanaccess.converters.loadjet$tablesloader.loadtableindexesuk(loadjet.java:794) @ net.ucanaccess.converters.loadjet$tablesloader.createindexesuk(loadjet.java:835) @ net.ucanaccess.converters

stata - Sort by variable in twoway scatter. X-axis stays alphabetical and sort produces gibberish: why? -

Image
i have 2 variables: ie_ctotal cntry2 note: cntry2 encode d version of string variable cntry : don't know if may affecting things. i want twoway scatter of ie_ctotal , cntry2 , , want sort scatter variable gdppc , twoway || scatter ie_ctotal cntry2, c(1) xlabel(,valuelabel) the above without sort works fine. once introduce sort , however, twoway || scatter ie_ctotal cntry2, c(1) sort(gdppc) xlabel(,valuelabel) the graph turns gibberish, or rather connects according sort , x axis remains alphabetical, making connections seem scribbled. any ideas doing wrong? note: don't want sort original data, because advised in previous questions bad idea. want sort data 1 graph. there no reproducible example here, , not graph, possible guess problem. you typing above c(1) which ill-advised, although stata right thing. better type c(l) which instructs stata join data points on graph in line. (nod @dimitriy v. masterov on detail.) in first ex

java - Invalid deployment descriptor web.xml -

whenever create new servlet on netbeans 8.0.2 shows, invalid deployment descriptor web.xml and there cross sign on web.xml too. web.xml <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <session-config> <session-timeout> 30 </session-timeout> </session-config>

c - Why can't we assign int* x=12 or int* x= "12" when we can assign char* x= "hello"? -

what correct way use int* x ? mention related link if possible unable find one. a string literal creates array object . object has static storage duration (meaning exists entire execution of program), , initialized characters in string literal. the value of string literal value of array. in contexts, there implicit conversion char[n] char* , pointer initial (0th) element of array. this: char *s = "hello"; initializes s point initial 'h' in implicitly created array object. pointer can point object ; not point value . (incidentally, should const char *s , don't accidentally attempt modify string.) string literals special case. integer literal not create object; merely yields value. this: int *ptr = 42; // invalid is invalid, because there no implicit conversion of 42 int* int . this: int *ptr = &42; // invalid is invalid, because & (address-of) operator can applied object (an "lvalue"), , there no object apply to

http - Per-Proxy Authentication in Java -

i trying support authenticated proxies in java application. understanding java.net.proxy class not support authentication, , need handle authentication yourself. i have created subclass of java.net.proxy class, takes 2 additional parameters, username , password. implementing http proxy authentication quite easy, , method gethttpproxyauthenticationheader returns base64 encoded auth info, pass httpurlconnection or similar. i'm having trouble sock proxies though. cannot find documentation on sending authentication socks server. i'm unsure if need implement socks authentication protocol in class using method such authenticatesocksproxy(outputstream stream), , call authedproxy.authenticatesocksproxy(outputstream); before using socket like outputstream.writebytes(mydata.getbytes()); another option return byte[] of authentication data , write data manually, instead of class writing authentication data. i not think java.net.authenticator, or system.setproperty metho

vb.net - add column in datagridview -

i use vb.net excel i have buttom "get name of column worksheet" combobox this code of button: private sub button7_click(byval sender system.object, byval e system.eventargs) handles button7.click dim excols new dictionary(of integer, string) form2.xlworksheet = ctype(form2.xlworkbook.sheets(form2.combobox1.text), excel.worksheet) form2.xlworksheet.activate() form2.xlworksheet dim lastcol integer = form2.xlworksheet.cells(1, form2.xlworksheet.columns.count).end(xldirection.xltoleft).column x integer = 2 lastcol excols.add(x, form2.xlworksheet.cells(1, x).value.tostring) next combobox2.datasource = new bindingsource(excols, nothing) combobox2.valuemember = "key" combobox2.displaymember = "value" addhandler combobox2.selectedindexchanged, addressof combobox2_selectedindexchanged end end sub this code of combobox: private sub combobox2_sele

mysql - Setting up Usernames and Passwords on Icecast Server 2 -

i have icecast server 2 set on digital ocean. using "butt - broadcast using tool" broadcast mountpoint on server inputting password , icecast username. now, trying set sign webpage need interface icecast server config file, , add user names , passwords people sign up. what best way this? wordpress -> mysql -> icecast? webform -> icecast? ? also, can host on same droplet icecast server? any sample code snippets, tutorials, links, documentation appreciated. icecast has simple yet powerful url authentication capability against arbitrary http/https ends. can used both listener clients , source clients. needed parse request sent , reply confirmation header. for further details, refer official documentation on topic. you can either run on same machine or somewhere else. point url.

android - Getting application context into fragment, ViewPager -

i'm writing simple app swipe view using viewpager , fullscreen fragments. in 1 of fragments want check internet connection status before displaying data can't application context. i've found lot of topics on issue, none of solutions works me. using getapplication() within fragment though error "unreacheable statement" . any advice? import android.support.v4.app.fragmentactivity; import android.support.v4.view.viewpager; import android.os.bundle; public class mainactivity extends fragmentactivity { viewpager viewpager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //setting fragment view pager viewpager = (viewpager)findviewbyid(r.id.pager); pageradapter pageradapter = new pageradapter(getsupportfragmentmanager()); viewpager.setadapter(pageradapter); } } activity_main.xml <android.support.v4.view.viewpager xmlns:android=&q

arrays - php form with multiple item checkbox populate excel spreadsheet -

i building form in php send owner email request , link page table show requests. keep getting "array" in output multiple item checklist... here have <form> <input type="checkbox" name="multimedia[]" value="assessment" />assessment<br/> <input type="checkbox" name="multimedia[]" value="elearning module" />e-learning module<br /> <input type="checkbox" name="multimedia[]" value="photography" />photography<br /> video shoot other <?php $multimedia = array(); echo implode(',', $_post['multimedia']); $multimedia_string = implode(',', $multimedia); ?> //variables in each cell $variables = array(); $variables['fname'] = $_post['fname']; $variables['lname'] = $_post['lname']; $variables['email'] = $_post['email']; $variables['projecttitle'] = $_po

ANDROID: How to have a canvas the responds to a user touch -

i'm new canvas , animations, wondering coding user touches be! in example saw this, switch (event.getaction()) { case motionevent.action_down: drawpath.moveto(touchx, touchy); break; case motionevent.action_up: drawcanvas.drawpath(drawpath, drawpaint); drawpath.reset(); break; default: return false; i'm not sure how works. if app wanting create responds move ball responding when user tapped, how should this? (think flappy bird screen moves up) in motionevent.action_down:, can't use canvas.getwidth() or parameters see user touched. thanks , :) to user touched you'd use event.getx() , event.gety(). wouldn't use canvas operations @ all.

multithreading - Is ImageMagick thread safe with `--without-threads` option? -

i load images imagemagick using multiple threads. safe when configured --without-threads option? from forum post on imagemagick.org -- "thread safe ?" : imagemagick thread safe, perform thousands of tests before release , without valgrind. this post includes sample unit test imagemagick uses another post -- "what lose disabling threads?" : imagemagick works fine without threads. however, number of imagemagick language wrappers ... assume threaded environment , applications crash , burn when call imagemagick methods more 1 thread of execution. threads enabled, imagemagick applies numerous mutex locks serialize splay-tree, hash, list methods, generating wand ids, etc. from third post "--disable-thread confusion" : imagemagick thread safe coder modules not (e.g. jpeg). if coder modules not thread safe serialize access module our own mutexes. more recent versions of imagemagick distinguish coder module thread support readin