Posts

Showing posts from April, 2013

asp.net ajax upload file real time progress bar not working -

i trying ajax file upload , real time progress bar, have tested in localhost , worked perfectly, when tried testing on online web server bar didn't work till end of uploading file, when put system.threading.sleep(value) in end of uploading loop, bar worked uploading slow, how can resolve this? the steps used: construct iframe(point upload.aspx) , file upload inside it. on pageload javascript function iframe page called window.parent.register(form) function predicate iframe form javascript variable in parent page. in parent page (default.aspx) placed button, , onclick iframe form predicated submited. javascript interval calls ajax callback function every (1000ms). this function (the ajax callback) watching session["uploadinfo"]. when iframe form submits iframe page, calls doupload() method reads file in while loop (fileupload.postedfile.inputstream.read(bytes,0,1);) writes byte in specific path, , adds (1) session["uploadinfo"] (which increases pro...

security - PHP: What is the origin of the 'type' index in $_FILES? -

in order validate allowed mime types in file uploads rely on fileinfo extension since extension or magic database isn't available though of using type index associated each file on $_files superglobal. so question is, index come from? suspect either comes browser (and if that's case can forged) or, likely, web server (or php) - , if case: extension mime type mapping or real thing? it's mime type of file supplied browser through interpreting extension of file. you're right, can forged client.

css - jquery and creating styles, how to check if the style already exists -

hi people have looked around cant seem find answer i'm looking for. i have search page makes ajax calls, returns json data creates style based on returned data , appends section of dom. creation of styles working ok, if new search made style duplicated , $(#element).slidetoggle() function gets duplicated , slidetoggle opens , closes immedietly. ypu can see page here: http://www.reelfilmlocations.co.uk/new%20search/fullsearch_jq_keys.php (use test data hounslow, north london , categories: cemeteries) if same search made twice styles results gets duplicated, , slide toggle behaviour duplicated.) my question how check if style in existence. the script creates style follows: function makecss(id){ var myurl = 'getboroughinfo.php'; $.ajax({ url: myurl, type: 'post', data: 'myid='+id, datatype: 'json', error: function(xhr, statustext, errorthrown){ /...

linker - solaris studio link against specific libc.so version -

i want compile/link on new solaris version (libc.so sunw_1.22.6) system older solaris (libc.so sunw_1.22.4). how can specify linker (on new version) should build binary uses older (1.22.4) libc.so? in general, unix systems support backward compatibility (a program built on older system continues work on newer system), not opposite: program built on newer system may not work on older system. for reason, build program on oldest os release going support. how can specify linker (on new version) should build binary uses older (1.22.4) libc.so you need "new solaris -> old solars" cross-compiler that. gcc can built such cross-compilation, not trivial. building on older system simpler approach.

What is the Android/Java corresponding method to the C# Stream object method Write()? -

a snippet of code want translate here: class mk { stream connection; tcpclient con; public mk(string ip) { con = new tcpclient(); con.connect(ip, 8728); connection = (stream)con.getstream(); } public void close() { connection.close(); con.close(); } public bool login(string username, string password) { send("/login", true); string hash = read()[0].split(new string[] { "ret=" }, stringsplitoptions.none)[1]; send("/login"); send("=name=" + username); send("=response=00" + encodepassword(password, hash), true); if (read()[0] == "!done") { return true; } else { return false; } } public void send(string...

visual studio 2010 - Sharepoint list and a word doc -

hi have word templateis used content type. want document used read , write data sharepoint list. want document track changes. possible? user1 edits doc, saves user2 makes changes. saves it. now since "databinding" list, can track changes? and want push data record center you can track changes using built in versioning tools sharepoint. give link read: http://technet.microsoft.com/en-us/library/cc262378.aspx

Is there a way to sync two sqlite3 databases? -

i'm leaning toward using couchdb, short of there way sync 2 sqlite3 databases have same schema? can try use uid primary keys instead of auto-incremented ones, don't know next steps if there any. http://old.nabble.com/attempting-to-merge-large-databases-td18131366.html that or rsync should need.

python - SQLAlchemy: cascade delete -

i must missing trivial sqlalchemy's cascade options because cannot simple cascade delete operate correctly -- if parent element deleted, children persist, null foreign keys. i've put concise test case here: from sqlalchemy import column, integer, foreignkey sqlalchemy.orm import relationship sqlalchemy import create_engine sqlalchemy.orm import sessionmaker sqlalchemy.ext.declarative import declarative_base base = declarative_base() class parent(base): __tablename__ = "parent" id = column(integer, primary_key = true) class child(base): __tablename__ = "child" id = column(integer, primary_key = true) parentid = column(integer, foreignkey(parent.id)) parent = relationship(parent, cascade = "all,delete", backref = "children") engine = create_engine("sqlite:///:memory:") base.metadata.create_all(engine) session = sessionmaker(bind=engine) session = session() parent = parent() parent.children.a...

php - Referencing classes as className::methodName() -

as far thought either instantiate class so: $class = new classname(); then use method in do: $class->mymethod(); or if wanted use within class without instantiating do: classname::mymethod(); i'm sure have used latter before without problems, why getting error says: fatal error: using $this when not in object context my code using call is: // display lists error message managelists::displaylists($e->getmessage()); the class follows.. class managelists { /* constructor */ function __construct() { $this->db_connection = connect_to_db('main'); } function displaylists($etext = false, $success = false) { // list data database $lists = $this->getlists(); ...... } function getlists() { ......... } } i getting error line.. $lists = $this->getlists(); when use format classname::methodname() , calling method 'statically', means you're calling...

Understanding Grouping in SQL Reporting Services 2005 Reports -

i have page header, body , page footer section, can't figure out how add additional 'group' sections sql reporting services report design (rdl) in visual studio 2005. take example: have dataset select department, employee salary employees order department, employee . want make report showing each employee's salary along department , company wide totals. in similar report designers defining grouping in report on department field. have department header section drop textbox department field, detail section drop textboxes employee , salary fields, department footer section drop textbox aggregate sum of departments salary, , (report) footer section drop textbox aggregate sum of employees salary. i have found table control in toolbox - can create "rows" match section definitions mentioned above, table control wants tightly follow it's rows , columns - cannot freely drop textbox in section, must size fit 1 cell in table. may great situations, not mine....

.net - Textboxfor mvc3 date formatting and date validation -

i've decided started mvc 3 , ran issue while trying redo 1 of web apps mvc3. i've got projects setup way: public class project { public int projectid { get; set; } [required(errormessage="a name required")] public string name { get; set; } [displayname("team")] [required(errormessage="a team required")] public int teamid { get; set; } [displayname("start date")] [required(errormessage="a start date required")] [displayformat(applyformatineditmode=true, dataformatstring="{0:d}")] public datetime startdate { get; set; } [displayname("end date")] [required(errormessage="an end date required")] [displayformat(applyformatineditmode = true, dataformatstring = "{0:d}")] public datetime enddate { get; set; } } and entry form written way dates: <table> <tr> ...

class - Python super method and calling alternatives -

i see everywhere examples super-class methods should called by: super(superclass, instance).method(args) is there disadvantage doing: superclass.method(instance, args) consider following situation: class a(object): def __init__(self): print('running a.__init__') super(a,self).__init__() class b(a): def __init__(self): print('running b.__init__') # super(b,self).__init__() a.__init__(self) class c(a): def __init__(self): print('running c.__init__') super(c,self).__init__() class d(b,c): def __init__(self): print('running d.__init__') super(d,self).__init__() foo=d() so classes form so-called inheritance diamond: / \ b c \ / d running code yields running d.__init__ running b.__init__ running a.__init__ that's bad because c 's __init__ skipped. reason because b 's __init__ calls a 's __init__ ...

xml - XPath: select text node -

having following xml: <node>text1<subnode/>text2</node> how select either first or second text node via xpath? something this: /node/text()[2] of course doesn't work because it's merged result of every text inside node. having following xml: <node>text1<subnode/>text2</node> how select either first or second text node via xpath? use : /node/text() this selects text-node children of top element (named "node") of xml document. /node/text()[1] this selects first text-node child of top element (named "node") of xml document. /node/text()[2] this selects second text-node child of top element (named "node") of xml document. /node/text()[someinteger] this selects someinteger-th text-node child of top element (named "node") of xml document. equivalent following xpath expression: /node/text()[position() = someinteger]

c# - Best practice, create interface of WebRequest -

if create interface of system.net.webrequest , what's best way that? to david's point, first need determine want interface before can decide members needs. if want interface unit testing, recommend separate approach. take @ answer votes this question . however, answer question strictly asked, since can't modify webrequest class, you'd first want subclass so: public class mywebrequest : webrequest, imywebrequest { } you add of public members exposed webrequest imywebrequest (remove members don't want exposed): public interface imywebrequest { stream getrequeststream(); webresponse getresponse(); iasyncresult begingetresponse(asynccallback callback, object state); webresponse endgetresponse(iasyncresult asyncresult); iasyncresult begingetrequeststream(asynccallback callback, object state); stream endgetrequeststream(iasyncresult asyncresult); void abort(); requestcachepolicy cachepolicy { get; set; } string me...

dependency injection - Autofac MVVM - Lifetime -

are there examples of using autofac in mvvm application? i'm not sure how 1 control lifetimes , disposal of objects in mvvm environment. i understand can create lifetime , resolve beneath it, seems more service locator pattern ioc pattern. i don't have public example, have done in silverlight applications. i used silverlight navigation framework organize top level of content. when frame navigated new page, created lifetime scope in resolved page's root view model, associated page through attribute: [viewmodel(typeof(ordersviewmodel))] public class ordersview : page when frame navigated different page, disposed lifetime scope before creating next one. the same pattern applies opening dialogs. each dialog gets own lifetime scope , view model. when closes, lifetime scope gets disposed. there situations don't fall neatly along these boundaries. need more granularity , can go deeper lifetime scopes using contextual scopes . these situations one-offs...

Android RelativeLayout issue -

i've got relativelayout 2 nested relativelayouts. want first rl stay on top , second scrollable, not work. <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <relativelayout android:id="@+id/relativetop" android:layout_width="fill_parent" android:layout_height="wrap_content"> <!--buttons--> </relativelayout> <scrollview android:layout_width="fill_parent" android:layout_height="wrap_content"> <relativelayout android:layout_width="fill_parent" android:layout_height="wrap_content"> <!--lots of nested relatilayouts views--> </relativelayout> </scrollview> </relativelayout> there xml attribute need know android:layout_below <relativelayout xmlns:andr...

Android Views Are Not As Tall As Specified -

i using relativelayout position views @ precise locations on screen. works expected when using view say, draws rectangle. when using android views edittext, drawn shorter specified 8 units. clicking outside of drawn edittext (but within parameters specified relativelayout) will, in fact, hit edittext. here code illustrate mean: package com.drawdemo; import android.app.activity; import android.content.context; import android.graphics.canvas; import android.graphics.color; import android.graphics.paint; import android.os.bundle; import android.view.view; import android.widget.edittext; import android.widget.relativelayout; public class drawdemo extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); relativelayout l = new relativelayout(this); relativelayout.layoutparams lp = new relativelayout.layoutparams(100,100); lp.leftmargin = 50; lp.topmargin = 50; ...

cgi bin - Complex cgi script works, but test.cgi doesn't -

i have 2 cgi files in same cgi-bin folder. 1 complex 300hundread lines script works fine, when comes simple cgi-script: #!/usr/bin/perl -w print "content-type: text/html\n\n"; print "<html><head>"; print "<title>cgi test</title>"; print "</head>"; print "<body><h1>i wrote web page using perl!</h1>"; print "</body></html>"; the web page return 500 internal server error... why?:( edit: ok, problem solved on 1 server, cgi works fine. but... i'm trying make cgi-scripts work on server , seems no matter keep getting "internal server error" message , nothing in error log. suggestions? two possibilities come mind: your simple script not have execute privilege set test.cgi special name redirected elsewhere server configuration can run test.cgi command line?

Changing Passwords PHP -

how can allow change of password md5 in mind. when accounts being created passwords being entered in md5. when display password field of course in md5 (don't worry testing purposes showing password in field instead of displaying hashes or dashes). so how go changing passwords then? when changed need in md5. don't display in password field. have 3 fields. 1 original password (for security), , 2 new password (one verification). when submitted, check old password, if it's right, md5 new 1 , save it.

windows phone 7 - Why to use UriMapping in WP7? -

can explain me meaning of urimappings in windows phone 7 , why use them? mean why need user friendly uri's in phone app? urimappings part of silverlight 3 navigation framework , since wp7 silverlight 3+ port supports same api. don't "have" use urimappings if doesn't jive programmatic zen. a lot of silverlight developers come web background (asp, php, asp.net, et al) , such comfortable idea of short, hackable, persistent , structured urls navigation. navigation odd thing on ui platform (even on silverlight) , such enabling developers successful in giving many options possible. personally, choose not use urimappings in wp7 apps have own mini-navigation framework resolves page names xaml urls. there's example in open source navigationservice.getparseurlstring() method , pages class . as side-note, in future releases of wp7 operating systems , wp7 developer tools might possible emulator/phone show full history of pages in stack. in mix10 that...

sql server - SQL Trigger Does Not Work When Trying to Have Trigger Send A Email -

i trying create database trigger fires off when new row inserted has specific word send email alert. email alert works when run code , trigger works if remove email piece , replace else. here code: alter trigger checkfordirty on dbo.messages insert,update declare @messagetext varchar(max) declare @badword1 varchar(50) set @messagetext = (select body inserted) set @badword1 = 'badword' if charindex(@badword1, @messagetext) > 0 begin exec msdb.dbo.sp_send_dbmail @recipients='message@email.com', @subject = 'test e-mail sent database mail', @body = 'someone said dirty' end go you advised decouple email sending code trigger - in trigger, insert information need "pending emails" table. create job periodically checks table , send email. you need re-write trigger cope multi-row inserts , updates. inserted pseudo table can contain multiple rows. so i'd write trigger this: create trigger checkfordirty on db...

ruby - Is there a Rails equivalent to PHP's isset()? -

basically check make sure url param set. how i'd in php: if(isset($_post['foo']) && isset($_post['bar'])){} is rough/best equivalent isset() in ror? if(!params['foo'].nil? && !params['bar'].nil?) end the closer match #present? # returns true if not nil , not blank params['foo'].present? there few other methods # returns true if nil params['foo'].nil? # returns true if nil or empty params['foo'].blank?

c# - Neat way of gettings position of my Object in linq collections -

this question has answer here: how index using linq? [duplicate] 7 answers i have object called week. week part of season object. season can contain many weeks. want find position of week (is first week in season (so #1) or second (so #2). int = 0; foreach ( var w in season.weeks.orderby(w => w.weekstarts)){ if(w.id == id){ return i; } i+=1; } at moment have. order weeks in second there start date make sure in correct order. , cycle through them until find week matches week looking at. , return int have been counting up.. i feel there should easier linq way feels pretty messy! if prefer not write findindex extension method or load sorted items array / list, use overload of select provides index of item: return season.weeks .orderby(w => w.weekstarts) ...

java - How to save the new values from cells, not the old ones? -

i have jtable in jscrollpane , data comes database. cells editable, , want save new values (the edited ones) in database. problem getvalueat(row, col) returns old, unedited values. here code takes values cells , insert them in database. defaulttablemodel tablemodel = (defaulttablemodel) table.getmodel(); int row = table.geteditingrow(); if(row == -1) return -1; string name = tablemodel.getvalueat(row, 0).tostring(); string stringprice = tablemodel.getvalueat(row, 1).tostring(); float price = float.parsefloat(stringprice); products.updateproduct(name, price); ... return 1; and here in updateproduct(name, price) method: update products set `prod_name` = 'old_name', `prod_price` = 'old_price' `id` = 4 instead of: update products set `prod_name` = 'new_name', `prod_price` = 'new_price' `id` = 4 there might simple solution, can't figure out. appreciated. without knowing how code snipped i...

Leaving values for options unevaluated in Mathematica -

i'm having problems writing function takes options. 1 of option values function. 1 @ value keep unevaluated. tried every single thing possibly think of nothing worked far. basically, illustrate tried: setattributes[foo, holdrest]; options[foo] = {blah -> none} foo[x_, optionspattern[]] := module[{blah}, blah = optionvalue[automatic, automatic, blah, hold]; . . . then when have: func[a_, b_, c_] := + b + c; i'd able call foo with: foo[2, blah -> func[1, 2, 3]] and have "blah" variable (inside foo) unevaluated, i.e. blah = func[1, 2, 3]. thanks in advance! edit: for reasons long elaborate, cannot use ruledelayed (:>). i'm trying write function in package, used other people don't know mathematica, have no clue :> is. using rules (->) specifying options , values standard way , familiar that. so further illustrate, let's i'm trying write number generator function takes function g...

iphone - connectionDidFinishLoading being called before connectionDidReceiveData has received all data? -

im having problem connectiondidfinishloading being notified before connectiondidreceivedata has received , processed data. problem ocurring because trying process data arrives , update tableview. think processing slowing things down , result before have processed data connectiondidfinishloading called , seem missing out on last 10-15% of data result. per apple docs states delegate not receive more calls after connectiondidfinishloading called. possible connectiondidreceivedata not being sent data because taking long time processing piece of data , connectiondidfinishloading called , subsequently connectiondidreceivedata isnt called again final pieces of data? fyi tried running data processing method in own thread doesnt seem help. btw had implemented same method in connectiondidfinishloading worked fine trying start processing data instead of waiting data load take while. here outline of code although have removed processing code little long , messy. -(void)connection:(nsur...

Link my Application with web site Use C# -

how can view images website in application using language c#. i don't want download page, want view pictures in application. you can use html agility pack find <img> tags.

Android Custom Widget Inflate Exception -

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/com.org.batterymanager" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <com.org.batterymanager.batteryview android:layout_width="match_parent" android:layout_height="wrap_content" app:textcolor="#ffffffff" /> </linearlayout> 02-17 18:49:49.392: warn/appwidgethostview(124): updateappwidget couldn't find view, using error view 02-17 18:49:49.392: warn/appwidgethostview(124): android.view.inflateexception: binary xml file line #9: error inflating class com.org.batterymanager.batteryview 02-17 18:49:49.392: warn/appwidgethostview(124): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:576) 02-17 1...

java beginner "Hello World" -

i trying learn java i dont understand why code won't work. it won't output "hello world" test() function. what doing wrong? public class main { public test(args) { system.out.println(args); } public static void main(string[] args) { test('hello world'); } } firstly: public test(args) { system.out.println(args); } you need type go parameter - java typed language , need specify type. type here, system.out.println() can take anything, set type string, object or whatever (since object has tostring() method , has lots of overloads deal primitives.) bear in mind unusual though, of methods come across take of specific type! since you're calling test main method here, , you're passing string it, may set type of args string. the second problem there's no return type specified. need specify return type, in case nothing returned type void . if don't compiler has no way of knowing whether...

F# compute height of a trie node -

i trying implement trie structure in f# method compute height of every node. this came far: type trienode = | subnodes of char * bool * trienode list | nil member this.char = match | nil -> ' ' | subnodes(c,weh,subnodes) -> c member this.getchild(c:char) = match | nil -> [] | subnodes(c,weh,subnodes) -> if subnodes.length > 0 [ (list.filter(fun (this:trienode) -> this.char = c) subnodes).head ] else [] member this.awordendshere = match | nil -> false | subnodes(c,weh,subnodes) -> weh module triefunctions = let rec insertword (wordchars:char list) = function | nil -> subnodes(' ', false, (insertword wordchars nil)::[]) //daca aici inca nu e cel putin un nod atunci fa nodul radacina standard adica nodul care nu e sfarsit de cuvant si //are ...

service - Question about android: I Want to upload images to server -

helllo i trying upload images server. if placed code in subclass of activity, sending interrupted onpause function when user leaving activity while user want use other application. if problem better use service upload file instead? your best best use asynctask. execute in background , give feedback on ui thread if need.

process - What exactly happens when you run a .NET executable (step by step to the point where the program is loaded and running)? -

when run .net executable, takes place, step step in order. basic understanding run executable, clr checking, compiles cil platform specific code, loads along specified required dll's (as specified in manifest(s)) , runs program. can elaborate on this, down "it allocates memory , that" level? know happening when double-click on executable when program running. p.s. diagrams, external links welcome. :-) there's reason information isn't accessible - because microsoft have learnt publish has remain fixed time (source: 90% of raymond chen's blog ). the ecma standard available here , though appears table of contents may not cover material after. specifies structure, though not internal implementation details. for specific internal details, need provide at least exact version of .net framework interested in (and we'll ignore other clrs such mono ) , details of program running. if have practical (ie. debugging) reason needing these details...

Creating WCF Service and deploying it to run in Sitecore context -

we have need add sitecore items programmmtically. achieve creating new wcf service standard webservice provided sitecore not serving our purpose. new wcf service created in vs2010 pushed/published same folder standard webservice(sitecore/shell/webservice). reason service doesn't work @ throws configuration errors. could let me know custom service should deployed. i had lots of issues deploying both wcf , old-style (.ascx) web services in sitecore-controlled application. never able find satisfactory solution, after speaking tech support. ended creating own http handlers accept post data , used instead of wcf. know it's not best solution, worked.

string - how to trim quotes and remove special characters from the word in php -

how trim quotes(single , double). , there character � in words want remove. how in php. example words want reformat poup�e poupe or � should have been “three three words" words poup�e should poupée. suggested, fix encoding instead of destroying french words :-)

javascript - How to hide/show JS-generated content? -

i need hide/show javascript-generated content, see below: $(window).load(function () { $("body").html('<a href="# id="ipsum">show ipsum</a><br />' + '<p id="lorem_content">lorem</p><p id="ipsum_content">ipsum</p>' + '<p id="dolor_content">dolor</p>'); $("p").hide(); $("p#lorem_content").show(); $("a").live("click", function() { $("p").hide(); $("p#" + $(this).attr('id') + "_content").show(); }); });​ http://jsbin.com/olebu3/edit the content, should shows after clicking on a#ipsum not being shown... why? jquery hide() method should set content " display:none ", not remove content, isn't true? change <a href="# id="ipsum" <a href="#" id="ipsum" in seco...

What's the difference between "Chain of responsibility" and "Strategy" patterns? -

i'm raising question because of another question asked here on days ago. had solve specific problem, , after 2 replies got, realized 2 patterns can solve problem (and other similar). chain of responsibility strategy my question is: what difference between patterns? they're different. strategy having generic interface can use provide different implementations of algorithm, or several algorithms or pieces of logic have common dependencies. for instance, collectionsorter support sortingstrategy (merge sort, quick sort, bubble sort). have same interface , purpose, can different things. in cases may decide determine strategy inside . maybe sorter has heuristics based on collection size etc. of time indeed injected outside . when pattern shines: provides users ability override (or provide) behavior. this pattern base of now-omnipresent inversion of control . study next once you're done classic patterns. chain of responsibility having chain ...

c++ - Motherboard Information -

i don't ways things other winapi (slow... , hard). so here i'll come request on how motherboard information, such ram type (ddr, ddr2, ddr3), manufacturer, model, southbridge, bios (brand, version, date). ram channels #, ram nb frequency. that's all. for getting hardware information can use wmi it can you.

callback - How do I restrict the number of clients that a user can add in Rails 3? -

basically want happen is, each user ('designer') can add number of clients restricted plan. if plan allows 1 client, that's can do. my user model looks this: class user < activerecord::base devise :database_authenticatable, :confirmable, :registerable, :timeoutable, :recoverable, :rememberable, :trackable, :validatable, :invitable has_many :clients, :through => :client_ownerships, :order => 'created_at desc' {edited brevity} end the client model looks this: class client < activerecord::base before_save :number_of_clients belongs_to :user has_many :projects, :order => 'created_at desc', :dependent => :destroy has_one :ownership, :dependent => :destroy has_one :designer, :through => :ownership validates :name, :presence => true, :length => {:minimum => 1, :maximum => 128} def number_of_clients authorization.current_user.clients....

mercurial - PyCharm and source control, the .idea directory, commit or not commit, that is the question -

i started new pycharm project , want version mercurial . there .idea directory in project directory following files (and assumption whether version them or not) .name - contains name of project (version: yes ) encodings.xml - contains defaults(?) text file encoding (version: yes ) misc.xml - contains components, , python executable use (version: no - because hard-codes path python.exe) modules.xml - contains list of modules, name of project in them (version: yes ) projectname.iml (version: yes ) vcs.xml - specifies vcs use (version: yes workspace.xml - seems list layout information pycharm windows (version: no ) are assumptions correct? all files except workspace.xml should shared, see faq .

java - What are swo and swp files in JBoss log dir? -

i have files server.log .server.log.swo .server.log.swp how open swo , swp? those temporary files created vim editor. .swp created when file opened in editor. .swo created if file edited , .swp exists. edit third time , .swn, , on. when vim closed, files should go away. if vim crashes or killed, may left behind. safe ignore.

android - Displaying images from a specific folder on the SDCard using a gridview -

i'm attempting create gridview loaded images specific folder resides on sdcard. path folder known, ("/sdcard/pictures") , in examples i've seen online unsure how or specify path pictures folder want load images from. have read through dozens of tutorials, hellogridview tutorial @ developer.android.com tutorials not teach me seeking. every tutorial have read far has either: a) called images drawable /res folder , put them array loaded, not using sdcard @ all. b) accessed all pictures on sdcard using mediastore not specifying how set path folder want display images form or c) suggested using bitmapfactory, haven't slightest clue how use. if i'm going in wrong way, please let me know , direct me toward proper method i'm trying do. ok, after many iterations of trying, have example works , thought i'd share it. example queries images mediastore, obtains thumbnail each image display in view. loading images gallery object, not requir...

filesystems - html showing contents of folder -

i creating web page show contents of folder people can view files , download them if needed. <a href="file:///c:\inetpub\wwwroot\test_pages">click here view folder</a> but wanna without coding ever, found code lets me view files. problem facing when double click html page , open hyperlink works , need when access page through server (iis 7) hyperlink nothing ? set permissions or ? can tell me im doing wrong ? the link work when file want download on own personal computer , in case true if you're showing html file locally. won't true users visiting website computer though. if want serve file on server, need link path on server itself , is, if file in c:\inetpub\wwwroot\test_pages , href looks this: <a href="/test_pages">click here view folder</a> offcourse, work simple files. folders, need enable webserver show directory contents enabling directory browsing .

Is programming against interfaces in Java the same concept as using header files in C/C++? -

the java code i'm working on @ moment has structure like file controller.java: interface controller {...} file controllerimpl.java: class controllerimpl implements controller {...} but every interface there 1 implementation. isn't same using header files in c/c++ have code split files controller.hpp controller.cpp from know, header files in c/c++ have been introduced compiler, not necessary anymore in java. header files should readability of code, having modern ide folding , outline view not necessity anymore. so why people again introduce header files in java through door programming against interfaces? no. in c++, files (headers) not same classes. programming against interfaces in java can done in c++, too, programming against abstract base classes . however, java term of "interface" quite restricted. basically, function declaration interface: void call_me(int times); as are, of course, classes , other types. in c++, group su...

javascript - calling js from obj-c openfeint -

i can call js obj-c phonegap plugin classes , main app delegate class follows: [webview stringbyevaluatingjavascriptfromstring:@"alert('hello');"]; you can because webview object can handled phonegap plugin classes , phonegap main app delegate. however integrating openfeint , has many of own classes. when try above code in openfeint delegate class doesn't work because openfeint delegate classes can't handle on webview object. can tell me how this? i've tried messing class interfaces , importing .h files in various places nothing seems working. webview sitting there somewhere. i hacker of obj-c opposed understands it. i have gotten achievements , leaderboards working app. relatively straight forward. users can create , send new challenges. but cannot users receive these challenges play them because of problem above (at least that's theory). i'll share openfeint know how once problem sorted , release app. cheers nige...

Windows Phone 7 Volume Settings programmatically -

is there way programmatically change sound settings of windows phone 7? enable or disable sounds appointment , other notifications? change global volume i.e.:ring tone. there no api enable tasks you've mentioned. can adjust sound volume sounds within application using xna api's, extent of control available.

java - Is possible to get web application full url from Spring service that is invoked by task? -

i have service not invoked user request, task. need send email task, , email contains link web application, how can full url of application email can link web application? example of service: @service public class myservice { @scheduled(cron="0 */10 * * * *") @transactional public void mytask() throws ioexception, parseexception { // have send email app url, how can here ? } } you cannot it, since web application doesn't know own domain name. can extract domain name used send request request. therefore domain name of application should part of configuration, , task should obtain there.

java ee - Creating and Deploying EJB's using Intellij 10 and GlassfishV3 -

does have tutorial on how create , deploy ejb's using intellij 10 , glassfish. have been working on learning j2ee basics , has been huge stumbling block have found tutorials else. thank you. please refer following official documents: developing applications glassfish server in intellij idea debugging applications glassfish server in intellij idea

java - How do I set the font size of the text on a swing jButton to the maximum size who fits the jButton -

i've got jpanel jbutton, , user can define size of jpanel when launching application using parameters, jbutton sizes according jpanel. the problem when use fixed font , panel large, font looks small, , vica versa. so font size should maximum font size fits in button. not sure, might find size using graphics.getfontmetrics() method inside paintcomponent-method? maybe can use fontmetrics.getstringbounds() methods , test if button contains rectangle (rectangularshape.contains()). you use binary search algorithm find max font. make sure take insets account.

dlopen - Calling function by name using dlsym in iOS -

can't call function name in ios? have c function called getstring . calling follows: void* handle = dlopen(null, rtld_now); if (handle) { fp func = dlsym(handle, "getstring"); if (!func) responsefield.text = [nsstring stringwithutf8string:dlerror()]; else { char* tmpstr = func(); responsefield.text = [nsstring stringwithutf8string:tmpstr]; } } else { responsefield.text = [nsstring stringwithutf8string:dlerror()]; } when executes, responsefiled.text set dlsym(...): symbol not found . means dlopen works not dlsym . dumped symbols in binary using nm , saw _getstring present. checked manual dlsym , says should not add underscore name. adding not solve issue anyway. doing wrong? i had asked similar question here calling functions name in objective-c , tried on mac following answers, problem seems specific ios. i believe problem dlopen not supported on ios, if statically link libraries. should able use dlsym(rtld_self, "gets...

android - How to access playlists on Galaxy Tab? -

i have created playlists in music application on galaxy tab, did not appear in mediastore.audio.playlists. i've noticed music app on galaxy tab different default one. maybe, stores playlists in other way? any ideas on how access playlists created in galaxy tab-specific music app?

iphone - Table view basics and appearance like MS Excel -

i new objective-c programming. please me understand how insert data table view visual style similar ms excel. it cannot want to, because tables in ms excel , on iphone different. the table view on ios has 2 items can configure show data -- datasoure , delegate. if can fetch data ms excel in such way can access particular data knowing row , column, data can shown in table view. in table view there concept of nsindexpath , structure of row numbers , corresponding section number. let's suppose there situation excel document has records of 1 hundred students , each record has 3 fields: name, age, sex. in situation you'll make table view 1 hundred sections , 3 rows each section. now suppose have view controller named myviewcontroller show table view, named mytableview : -(void)viewdidload { mytableview.datasource = self; mytableview.delegate = self; } now before can need following in myviewcontroller.h file @interface myviewcontroller: uiviewcon...

get list name in sharepoint 2010 -

how current used list name. scnerio is: have list said config. have create 1 column "test" datatype "managed metadata". after add column.now when edit item , click on icon near "test" column 1 dialog open webtaggig.aspx that. now, had open custom control in page. when page opened , control loaded. on custom control page load want list name programatically. can 1 suggest me how can this? have @ spcontext object. need spcontext.current.list.title name or title of current list.

java - class attributes declaration, order of the attributes' properties (final, private, static, type) -

i'm trying find documentation on best way order properties of class attribute, such private/protected/public, final, static, type. i'll post example see mean. class { public final static int foo = 3; final public static int foo = 3; } ok, assume attrbiute type (int, string, char) goes before name of attribute. my real doubt when try position static, final, , v the language specification says modifiers must go before type , int comes last. modifiers include type parameters, annotations, access modifiers (private, protected, public), static , final , synchronized , strictfp , volatile , transient , (from "what allows compiler") can come in order. some days ago did google search , static final more final static , helps ordering them :-) i think in general order of modifiers common: annotations type parameters access modifiers static final transient (only fields) volatile (only variables) synchronized (only methods) i nev...

.net - Will managed C++ (CLI) code ported from C# work faster than original C#? ( tcp server) -

so created simple c# tcp sever video sharing. simple , shall done "life" - recive live video packed container (flv in our case) broadcaster , share recived stream subscribers (means open container , create new containers , make timestamps on container structure not decode contents of packets in way). tested our server found out performance not enough 5 incoming streamers , 10 outgoing streams. fe found this app porting. try way before try wonder if of have tried such thing on of projects. main question - c++ cli make app faster original c#? no. writing same code in different language won't make difference whatsoever; still compile same il. c# not slow language; have higher-level performance issues. should optimize existing code.

estimation - Upgrade CAB and Prism 2 to Prism 4 -

we have several cab , prism 2 applications plan migrate prism 4. has experiance migration of cab and/or prism 2 applications prism 4? are there "gotchas" should aware off? how estimate migration? example x% of original development cost or y hours per screen work. i have upgraded large (30 module) prism 2 application. took day in total, of time spent changing namespaces , references. followed information microsoft supplied when upgrading. leaving di unity made process easier, have taken longer if had moved unity mef. i've yet hit "gotchas", update answer if/when do. it's worth noting changes commands otherwise come across invalidcastexception, t delegatecommand not object nor nullable.

referential integrity - Should I enforce business logic through database errors? -

there's interesting design decision i've been thinking lately. let's i'm adding usernames table, , want make sure there no duplicates. username column not null unique . either: query database before inserting make sure there no duplicate names, or just insert , , catch exceptions come database engine. assuming db i'm using capable of enforcing constraints, wondering situations each of these choices appropriate in. it seems idea option 2. wouldn't recommend option 1 because you've doubled amount of time required inserts (they require reads first). besides, new developer going commit sometime , not check, , broken. another thing consider how downtime appropriate? mission critical app? happens if business logic corrupt? factories shut down if is? or annoying bugs. you can't afford have factories shut down because exception didn't think of crashed server. so, perhaps nightly or weekly check on data correctness can in case. however...

java - JTree Line Style and Nimbus -

Image
i using nimbus , feel. according link , should able achieve 3 different line styles jtree: while using following code: thetree.putclientproperty("jtree.linestyle", "horizontal"); my jtree looks this: it has "none" style , not "horizontal" style. idea why might be? have nmbus? need call special after setting property? thanks i don't believe nimbus supports jtree.linestyle property. metallookandfeel does. take @ source code javax.swing.plaf.synth.synthtreeui (which used nimbus) , metaltreeui (which used metal). change metallookandfeel , see if works.

java - How to end android service after ASyncTask it spun off completes? -

i have downloader service loads list of downloads run database. it creates asynctask run downloads in background thread. this works well, problem don't have way tell service downloader has completed. somehow have send service message asynctask's onpostexecute function (which runs on uithread). i can't close service remotely because service has work when asynctask completes. i've considered registering listener service , calling in onpostexecute, think cause problems closing service before task complete or threadlocking issues. how can send message (like broadcast intent) downloader service asynctask? edit here's code of confused doing. downloadservice.java (important bits): public class downloadservice extends service implements onprogresslistener { /** downloads. */ private list<download> mdownloads = new arraylist<download>(10); private downloadtask mdownloadtask; /** intent receiver handles broadcasts. */ private broadcastrec...