Posts

Showing posts from September, 2010

Get object name of a class from the user in Java -

i want user enter name of object used in code. example, if have class public class person{ ....... } now instead of me creating object specific name like person student; i want user enter name object maybe teacher, , object teacher of class person created. not know if possible in java, many of solutions looked using map, explanations not clear enough me new java. so, if explain how can done code snippets wonderful. also please explain how hashmaps work in java , if can used implement problem above. grateful if explained code examples it's not possible. names of local variables not persistent in compiled class file. names of fields there, part of api, have modify class file runtime - , not want. with hashtable, may done this: hashtable<string, person> hashtable = new hashtable<>(); hashtable.put("student", new person()); then may "variable" by: person person = hashtable.get("student"); when guess trying do

guava - Concatenate Collections with Java 8 -

i want iterate on collection of collections. guava this: import static com.google.collections.iterables.*; class group { private collection<person> persons; public collection<person> getpersons(); } class person { private string name; public string getname(); } collection<group> groups = ...; iterable<person> persons = concat(transform(groups, group::getpersons())); iterable<string> names = transform(persons, person::getname); but how can same thing java 8 streams? groups.stream().map(group::getpersons())...? you can achieve flat mapping elements of stream stream. let me explain code: groups.stream() .flatmap(group -> group.getpersons().stream()); what here, is: obtain stream<collection<group>> . then flat map every obtained stream<person> , group , original stream, of type stream<person> . now after flatmap() , can whatever want obtained stream<person> .

php - Doctrine - Add foreign key pointing to 2 target entities -

i have 3 entities; blog, project , comment. block , projects both have comments. want foreign key ref_id in comment point either blog or project using ref_type value. here entities class blog { ... protected $id; ... protected $title; ... } class project { ... private $id; ... private $title; } class comment { ... protected $id; /** * @orm\column(type="string") */ protected $ref_type; /** * @orm\manytoone(targetentity="**project,blog**", inversedby="comments") * @orm\joincolumn(name="ref_id", referencedcolumnname="id") */ protected $ref_id; } i new in doctrine might simple can find solution. google came across mapped superclasses not sure how relevant issue. yes, solution subclassing blog , project . prepare db at first place, can make subclass inherent table . let super class named "commentable". create table commentable( int id_commentable not null

java ee - How can i keep a file selected from input type="file" -

i have small web application witch contains button witch declared in html <input type="file" name ="b1" value="browse"> use file selected descktop how can keeped name of file , file lot write contains textarea , thanks. add id <input> : <input type="file" name ="b1" id="b1" value="browse"> in <head> : <script> var file_name = document.getelementbyid("b1").value; //file_name file </script>

javascript - JS - How to add an onclick event to a div with parameter? -

i know how add onclick event div without parameter : newdiv.onclick = selectunit; function selectunit() {} but not make work parameters : function appendunit(nb) { var newdiv = document.createelement("div"); newdiv.id = "unit" + nb; newdiv.onclick = selectunit(this.id); // throws me undefined document.getelementbyid("unitslist").appendchild(newdiv); } function selectunit(id) { console.debug(id); } how can ? you'll need anonymous function that, there no way pass arguments referenced function function appendunit() { var newdiv = document.createelement("div"); newdiv.onclick = function() { selectunit(this.id); } document.getelementbyid("unitslist").appendchild(newdiv); } function selectunit(id) { console.debug(id); } but note value of this keep, can function appendunit() { var newdiv = document.createelement("div"); newdiv.onclick = sel

python - How to import correctly my function from parent folder -

i have following layout: /project /thomas /users /src code_alpha.py /tests code_beta.py i tried: /project /thomas /users __init__.py /src code_alpha.py /tests code_beta.py with from users.src import code_alpha also tried: /project /thomas /users __init__.py /src code_alpha.py __init__.py /tests code_beta.py with from users.src import code_alpha i tried solve problem guide , similiar topics here, not figure out. adding directory path did not solve problem. edit: updated layout. did run python script running command: python code_beta.py in folder tests ? if did, can create __init__.py in tests , try run: python -m users.test.code_beta in thomas floder (make sure have __init__.py

java - Problems communicating Business Layer (JPA) with Presentation Layer (Netbeans 7.x) -

i develop "database based" java desktop application in following way: develop data access layer ( dal ) using jpa (pojos generated netbeans 7.4) develop business layer ( bl ) (my own classes, controllers, etc.) develop presentation layer ( pl ): graphical user interfaces (panels, frames, dialogs) making ( pl ) communicate ( bl ) i developed (dal + bl) in single netbeans project (projectdbl.jar). i developed pl in separate netbeans project (projectgui) i importing projectdbl.jar projectgui compiled library. i didn't add eclipselink libraries projectgui since added in projectdbl.jar. i didn't add database driver library projectgui same reasons. i separate between dal+bl , pl. further database modification (mysql->sqlserver example) should not impact done in pl. the problem facing kind of exception raising when want invoke method in projectdbl.jar: exception in thread "main" java.lang.noclassdeffounderror: javax/persistence/entit

google cloud sql - How do I persist MySQL configuration variables in CloudSQL? -

i can't seem find instructions or examples on how set , persist mysql configuration variables in google's cloudsql. the specific problem i'm encountering interactive sessions hang around 8 hours default and, if disconnected interactive session thread remains open , update transactions block until kill thread. the solution found one : set global interactive_timeout=300; to terminate interactive session after 5 minutes. but solution not work because error: error 1227 (42000): access denied; need (at least 1 of) super privilege(s) operation and adding super privileges fails this: mysql> grant super on *.* 'root'@'%' identified '<pwd>'; error 1045 (28000): access denied user 'root'@'%' (using password: yes) so seems root user of cloud sql instance not have sufficient privileges set global variables. separately, can't figure out how persist setting remain in place if server restarted. i've loo

javascript - Sorting a JSON object excluding an item -

i have json object follows: [ {"at&t" : "blocked"}, {"all" : "targeted"}, {"verizon" : "blocked"}, {"sprint" : "blocked"} ] which sort alphabetically using following function: sortbykey : function(array, key) { return array.sort(function(a, b) { var x = a[key]; var y = b[key]; return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }); }, this works fine. want exclude {"all" : "targeted"} sorting , have first element of json object so: [ {"all" : "targeted"}, {"at&t" : "blocked"}, {"sprint" : "blocked"} {"verizon" : "blocked"}, ] could give me hint of on how can achieved? i'll need way exclude item json object sorting , set first element of object. thanks in advance! if want exclude value, eg keep @ top of

capistrano - Recap Procfile with Passenger for Rails 4 App -

i trying use recap deploying rails 4 app capistrano. in docs , says: the ruby recipe [...] includes foreman support, starting , restarting processes defined in procfile. my app needs 2 processes restarted each deployment: passenger delayed job i've added gem 'foreman' gemfile, , attempt @ procfile is: # procfile web: sudo service nginx restart worker: bin/delayed_job restart but it's wrong since nothing gets restarted when deploying. what correct procfile like? alternatively, if wrong approach taking in first place, better approach ensure these processes restarted on each deploy? i ended giving on foreman, , using following code instead. (because had started delayed_job on server different user, , app user not have permission stop other users' processes, had first manually stop delayed_job on server.) # in capfile namespace :passenger task :restart run "touch /home/intouchsys/app/tmp/restart.txt" end end

Flask Admin - performance difficulties -

i facing performance problem in flask-admin, although performance of flask application good. my model is: class ck(base): __tablename__ = "ck" id = column(integer, primary_key=true, autoincrement=true) nazev = column(string(100)) kontakt = column(text) terms = relationship(term, backref=backref('ck', lazy='noload'), lazy='dynamic') class term(base): __tablename__ = "term" id = column(integer, primary_key=true, autoincrement=true) hotel_id = column(integer, foreignkey('hotel.id')) ck_id = column(integer, foreignkey('ck.id')) ... addons = relationship(addon, secondary=term_addon, backref=backref('term', lazy='noload'), lazy='dynamic') class hotel(base): __tablename__ = "hotel" id = column(integer, primary_key=true, autoincrement=true) country_id = column(integer, foreignkey('country.id')) area_id = column(integer, fo

PHP DOMDocument | ends by null char (\u0) -

i noticed on url: http://www.bubbleroom.se/sv/kläder/kvinna/controlbody/bodys/body-nero there null character \u0 in tag id prodtext . the whole document seems end null char when attempting extract else after character. edit the code "doesn't" work. works, not when there's null char in $html string $dom = new domdocument; libxml_use_internal_errors(true); $dom->loadhtml($html); libxml_clear_errors(); return new domxpath($dom); i solved issue filtering html before creating xpath instance following code: $html = str_replace("\0", "", $html);

c# - How I send a constructor's two arguments to an event handler which manages a method? -

hy, i have following constructor public playme(**int rows, int cols, string name**) { **this.rows = rows; this.cols = cols; this.name = name;** .............................. whith following event handler: **load += playme_load<int>(rows, cols);** initializecomponent(); } and method playme_load ( error before compiling: non generic method playme cannot used whith type arguments ...) void playme_load(int rows, int cols) { // set form components; maximizebox = false; autosize = true; formborderstyle = formborderstyle.fixed3d; backcolor = color.fromargb(30, 164, 6); font = defaultfont; **createboard(rows, cols);** how manage send arguments between constructor , event handler , method. referring @ rows , cols variable, can use name variabile also. sincerly, i see rows , cols stored in private fields (this.rows, th

html - Text and div vertical aligning inside a list element -

i have following layout: <ul> <li>text <div class="task"></div> </li> </ul> see fiddle . having problems aligning text text . on same line div . align (vertically) text middle of div . have tried nesting text inside span , giving span margin-bottom, padding-bottom , nothing seems work. beware of spacing issues inline-block - http://robertnyman.com/2010/02/24/css-display-inline-block-why-it-rocks-and-why-it-sucks/ http://jsfiddle.net/6axbh/1/ .task { display:inline-block; vertical-align: middle; }

javascript - Get values from object array in jquery -

i having data in jquery how groupname2 values grouplist user1,user2 etc: {"groupslist":{"groupname":["user1","user2","user3"],"groupname2":["user1","user2","user3"],"groupname3":["user1","user2","user3"]}} i have declared grouplist={} , push groupname values dynamically in console when print grouplist ` object {user00: array[3], super user: array[1], supreme user: array[0]} super user: array[1] 0: "sample_vh.com" length: 1 __proto__: array[0] supreme user: array[0] user00: array[3] 0: "veera_tls.com" 1: "v_v.com" 2: "sample_vh.com" length: 3 __proto__: array[0] __proto__: object` var o = { "groupslist":{ "groupname":["user1","user2","user3"], "groupname2":["user1","user2","user3"], "groupname

php - Regex to match all closing HTML tags -

for reason, need remove closing html tags string in php, need regular expression match closing html tags. i'm extremely unexperienced regular expressions, tried using /\<\\.*\>/g , /<\\.*>/g , didn't work. should use instead? please note want match closing html tags. opening html tags should remain untouched. in advance! use regex: </.+?> or /<\/.+?>/ that do. live demo

Why setHTML("<table><tr>..</tr></table>"); but then getHTML(); return "<table><tbody><tr>..</tr></tbody></table>" (Gwt)? -

i don't understand how gwt sethtml & gethtml work. doesn't seem consistent. let see example: myinlinehtml.sethtml(safehtmlutils.fromsafeconstant("<table><tr><td>test</td></tr></table>")); system.out.println(myinlinehtml.gethtml()); output: "<table><tbody><tr><td>test</td></tr></tbody></table>" clearly when set html myinlinehtml don't have <tbody></tbody> , when gethtml myinlinehtml gwt include <tbody></tbody> . why that's happen because can confusing when want html value , thought has same value time set hasn't? does happen independently browsers or dpendently browsers? cos serious. this how html parsed (how browsers expected parse it). in html 4, table defined (in terms of sgml) requiring tbody child element, , tbody defined both start , end tags being optional. in html5 (which codifies how b

matrix - Matlab, define submatrix -

Image
i got 10x10 matrix bunch of zeroes , element of value 1. i'm trying create submatrix element of 1 , surrounding. problem: this example, element "1" placed anywhere within matrix. realise can find element using find find(matrix==1) . how define 3x3 submatrix? you need use 'find' indices of '1' element, , construct desired matrix them. like: [row, col] = find(matrix==1); submatrix = matrix(row-1:row+1, col-1:col+1); of course, might need check '1' element not in border of matrix (i.e. row-1, row+1, col-1, col+1 not out of bounds). best.

Run file with Sandboxie using autoit -

my path of file c:\documents , settings\12313\my documents\downloads\bubble_hit_tsa31dibx.exe i wanna run sandboxie anytime redownload,the name of file changing. example:buble_hit_ ** .exe " * " changing. you can use wildcard feature of filefindfirstfile , filefindnextfile autoit. helpfile functions contains example of enumerating on set of files match pattern, interested in first, have call filefindnextfile once. i implement function following: ; returns matching file name. ; if file not found return empty string , sets @error 1 func _findfile($wildcard) local $hsearch = filefindfirstfile($wildcard) if $hsearch = -1 return seterror(1, 0, "") local $ret = filefindnextfile($hsearch) local $found = not @error fileclose($hsearch) if not $found return seterror(1, 0, "") return $ret endfunc ;==>_findfile which called (to find program files (x86) ): msgbox(0, "test", _findfile("c:\progra

Delphi XE3 Failing to generate new exe file when compiling -

as title says, when compiling, delphi fails generate new exe file, , instead deletes old one. has started today. ideas why? comment if want more info , i'll add edit info! thanks! i faced issue before , caused anti-virus . check point :)

scala - Why does leaving the dot out in foldLeft cause a compilation error? -

can explain why see compile error following when omit dot notation applying foldleft function?(version 2.9.2) scala> val l = list(1, 2, 3) res19: list[int] = list(1 ,2 ,3) scala> l foldleft(1)(_ * _) <console>:9: error: int(1) not take parameters l foldleft(1)(_ * _) ^ but scala> l.foldleft(1)(_ * _) res27: int = 6 this doesn't hold true other higher order functions such map doesn't seem care whether supply dot or not. i don't think associativity thing because can't invoke foldleft(1) it's because foldleft curried. using dot notation, can fix adding parentheses: scala> (l foldleft 1)(_ * _) res3: int = 6 oh - , regarding comment not being able invoke foldleft(l) , can, need partially apply this: scala> (l foldleft 1) _ res3: ((int, int) => int) => int = <function1>

c# - Export file using image saved to memory stream -

i wanting save image file has been stored in memory stream. i have saved asp.net chart memory stream. stream1 = new memorystream(); chart_location_3.saveimage(stream1, chartimageformat.png); and using following code export jpg. triggers save prompt , creates file image not open ("this not valid bitmap file, or format not supported") system.web.httpresponse response = system.web.httpcontext.current.response; system.drawing.image img; img = system.drawing.image.fromstream(stream1); response.clearcontent(); response.clear(); response.contenttype = "image/jpg"; response.addheader("content-disposition", "attachment; filename= exported.jpg;"); response.write(img); response.flush(); response.end(); changed response write to: response.binarywrite(stream1.toarray());

Import GraphML to Neo4j: how to specify node labels? -

i want import graphml data neo4j database (version 2.0.1). question is, how can specify neo4j node label in graphml? i tried following no avail: <!--this format used when exporting neo4j data graphml--> <node id="1" labels=":page"> <data key="labels">:page</data> </node> so, how should format xml neo4j recognize node labels? node labels can imported using -t switch of import-graphml command. neo4j-sh (?)$ import-graphml [...] -t import labels labels node attribute and/or labels property.

javascript - prevent a link from redirecting to another page -

i have link in page, , want prevent link redirect me link in href attribute. i tried following: $(function(){ $('#logout-link').click(function(event){ event.preventdefault(); $.ajax({ url : $(this).attr('href'), success : function(data){ $('#login-loader').hide(); location.reload(true); }, error : function(){ $('#error-login').replacewith('<div id="error-login" class="msg fail"><p>une erreur été rencontrée lors du deconnexion!</p></div>'); } }); }); }); but stills redirect me tho other page. how can prevent link redirecting page ? try return false; instead of event.preventdefault(); use after ajax call.

Download a XML file via jsf -

i trying download xmls file zipped archive using richfaces. have done usual way of downloading files. have requirement download zip .xlsx files. same piece of code working zipped archive of xlsx files. i have throwdownload() follows.. public void throwdownload(bytearrayoutputstream baos, string filename) throws ioexception { facescontext facescontext = facescontext.getcurrentinstance(); externalcontext externalcontext = facescontext.getexternalcontext(); httpservletresponse response = (httpservletresponse) externalcontext .getresponse(); response.reset(); response.setcontenttype("application/zip"); response.setcontentlength( baos.size() ); response.setheader("content-disposition", "attachment; filename=\"" + filename + "\""); bufferedoutputstream output = null; final int buffersize = 20480; output = new bufferedoutputstream(response.getoutputstream(),

Android Notification: Flash Message in Notification Area -

in android app, provide notification both when user begins uploading file , when file upload complete. when upload begins, message "uploading" appears in navigation bar. want message "uploading complete" flash in navigation bar when upload complete, message never appears in navigation bar. when expand notification drawer, though, correct message shown. how content title flash in navigation bar? notificationmanager mnotificationmanager = (notificationmanager) context.getsystemservice(context.notification_service); constant.currentlyuploading.decrementandget(); constant.totaluploadedimages.incrementandget(); if(constant.currentlyuploading.get()>0){ string files_count; if(constant.currentlyuploading.get() ==1){ files_count = "file"; }else{ files_count = "files&quo

vba - How to apply macro after a certain page / line in a word document? -

Image
i made macro , wanted apply in text page or right line. in image below shows how wanted apply macro, page 2 , red line, text pasted after red line. thanks in advance help. this button codes: private sub commandbutton1_click() selection.find.clearformatting selection.find.replacement.clearformatting selection.find .text = ".^p" .replacement.text = "!teste!" .forward = true .wrap = wdfindcontinue .format = false .matchcase = false .matchwholeword = false .matchwildcards = false .matchsoundslike = false .matchallwordforms = false end selection.find.execute replace:=wdreplaceall selection.find .text = "^p" .replacement.text = " " .forward = true .wrap = wdfindcontinue .format = false .matchcase = false .matchwholeword = false .matchwildcards = false .matchsoundslike = fal

android - non-empty constructor issue -

i have tried make non empty constructor no success. eclipse says : from fragment documentation: every fragment must have empty constructor, can instantiated when restoring activity's state. recommended subclasses not have other constructors parameters, since these constructors not called when fragment re-instantiated; instead, arguments can supplied caller setarguments(bundle) , later retrieved fragment getarguments(). so how can make non empty constructor? here code : import java.util.arraylist; import java.util.list; import android.annotation.suppresslint; import android.content.context; import android.os.bundle; import android.app.listfragment; import android.app.loadermanager.loadercallbacks; import android.content.asynctaskloader; import android.content.loader; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.arrayadapter; import android.widget.textview; public class mylist

Python program errors -

i'm writing program needs find pairs of initial conditions (x0,y0) x goes extinct first , plot them.the equations are: j=x-y+100 , i=x+y-100 and constraints (0,200) in both x , y directions. my code looks this: for x in range (0,201): y in range (0,201): c=0 i=x j=y while (x > 0 , y > 0): i=x-y+100 j=x+y-100 c=c+1 if i==0: plot(i,j) if c==50: break and error says: traceback (most recent call last): i=x-y+100 file "", line 1, in <module> file "/tmp/tmpqtzdaj/___code___.py", line 3, in <module> exec compile(u'for x in range (_sage_const_0 ,_sage_const_201 ):\n y in range (_sage_const_0 ,_sage_const_201 ):\n c=_sage_const_0 \n i=x\n j=y\n while (x > _sage_const_0 , y > _sage_const_0 ):\n i=x-y+_sage_const_100 \n j=x+y-_sage_const_100 \n c=c+_sage_const_1 \n if i==_sage_const_0 :\n

actionscript 3 - Action Script 3. How to add multiple children of 1 instance? -

i'm creating flash game. need make player lives - heart images. if player have 5 lives should added 5 hearts <3 <3 <3 <3 <3. have image instance name heart. how add them correctly? i've tried this: var lives:number = 4; var currenthp = lives; var heart:heart = new heart(); var hparr:array = new array(); function hp() { (var i=0; i<lives; i++) { heart = new heart(); hparr[i] = heart; hparr.push(heart); heart.x += heart.width+20; addchild(heart); } trace("array length" + hparr.length); } this correctly return 5 trace("array length" + hparr.length); , means hearts added array. problem 1 heart added. can problem? change for loop this: (var i=0; i<lives; i++) { heart = new heart(); hparr.push(heart); heart.x = ( heart.width + 20 ) * i; // here trick! addchild(heart); }

objective c - NSURLSession uploadTaskWithRequest - use block within completion handler -

i have class manages calls api. has method manage this, lets call callapimethod: this method accepts success , fail block. inside method, call uploadtaskwithrequest make call api. within uploadtaskwithrequest completion handler i'd (depending on result) pass results through either success or fail blocks. i'm having issues this. works , keeping super tidy when call callapimethod using success/fail blocks it's locking ui/mainthread rather being asynchronous i'd expect. how should go implementing pattern? or there better way go it? i don't need support pre-ios7. thanks edit: basic implementation discussed above. - (void)callapimethod:(nsstring *)method withdata:(nsstring *)requestdata as:(krequesttype)requesttype success:(void (^)(id responsedata))success failure:(void (^)(nsstring *errordescription))failure { [redacted] nsurlsession *session = [nsurlsession sharedsession]; nsurlsessiondatatask *task = [session uploadtaskwithreque

I want use Java Function in Android Project -

i have function. function worked in java project. want function use android project. while using. project "unfortunately .. has stopped. mi ? function public string yandex_translate(string yandex_lang,string yandex_text) throws ioexception, parseexception{ string yandex_key = "****"; string yandex_url = "https://translate.yandex.net/api/v1.5/tr.json/translate?key="+yandex_key+"&lang="+yandex_lang+"&text="+yandex_text; url url = new url(yandex_url); urlconnection httpurlconnection = url.openconnection(); inputstream inputstream = httpurlconnection.getinputstream(); bufferedreader bufferedreader = new bufferedreader(new inputstreamreader(inputstream)); string line=bufferedreader.readline(); jsonparser parser = new jsonparser(); jsonobject jsonobject = (jsonobject) parser.parse(line);; jsonarray msg = (jsonarray)jsonobject.get("text");

android - NullPointerException sqlite -

i trying store oauth tokens in database using sqlite. when creating new row, getting "nullpointerexception." receiving token instagram (it works if storing in shared prefs), fails if try , store in sqlite. my tokendatasource: public class tokendatasource { // database fields private sqlitedatabase database; private dbhelper dbhelper; private string[] allcolumns = { dbhelper.column_id, dbhelper.column_token }; public void close(){ dbhelper.close(); } public void open() throws sqlexception{ database = dbhelper.getwritabledatabase(); } public tokendatasource(context context){ dbhelper = new dbhelper(context); } public void deleteinstagramtoken(instagramtoken token) { long id = token.getid(); database.delete(dbhelper.table_insta_tokens, dbhelper.column_id + " = " + id, null); } public instagr

object - Deleting this in javascript -

this question has answer here: destroy 'this' javascript? 1 answer i'm trying write js function , i'd add destroy() functionality it. code goes this: function jsfunc(obj) { var inputcontrol=function(){ //check input object special rules. // i.e obj.wait_time isn't defined, return false } if(!inputcontrol()) { return false; } var do_some_operation=function() { //do } var destroy=function() { delete (this); } } var obj={ wait_time:100, //... } var xxx= new jsfunc(obj); $('#button').click(function(){ xxx.destroy(); }) when click #button doesn't anything. tried search web, found solutions , tried did not work. i tried these code destroy() function: 1. this=null; 2. for(var in this) { delete(this[i]); } when use 1 of t

Apply temporary css stylesheet on all pages using php javascript -

i have create website disable users, can change page contrast css 1 user selects different colour, far have javascript so, when click on page, in page reloads/refresh css style goes default one. understand there must way save cookie, new php , javascript: here html: <body runat="server" id="body" style="zoom: 100%"> <div id="container"> <div id="highvis"> <ul> <li class="highviss"> <a href="#" onclick="swapstylesheet('css/webcss2.css');return false;">high vis</a> <li> <a href="#" onclick="swapstylesheet('css/webcss3.css');return false;">dark</a> <li> <a href="#" onclick="swapstylesheet('css/webcss.css');return false;">default</a> <li><a href="#" onclick="zoomin();return false;">zo

c# - Increase 1 to variable ,when we create an object -

hey i'm creating employed program tried make constructor share value wont create class called (employed ) inlcude instance variables : name string ; num int ; count int instanse 120 ; create proparaty set , name , proparaty count * every creating object increase 1 count public class employed //creating class { // creating instanse variable private string name; private int number; private static int count; //declare static can use in static method public string proparaty { set { name = value; } { return name; } } public int propartyforcount { { return count; } } static employed() { // make static can share value count = 120; count++; } } static void main(string[] args) { employed c1 = new employed(); employed c2 = new employed();

css - When i try to flip images with`transform: rotateY(60deg);` it will not flip 60deg -

when try flip images with transform: rotatey(60deg); not flip 60deg 0deg. using google chrome bug or...? i has set styles on image class ig . work image class? thanks, pascal gerrist google chrome webkit browser. have user prefix css3 codes. and code : -webkit-transform: rotatey(60deg); demo : jsfiddle

Android Eclipse: Sharing image to facebook without mediaStore.Insert() -

i share screenshot facebook, twitter, etc, using intent. have found code examples achieve inserting image media store , grabbing uri image. however, not want clog user's device these useless images, , not want ask access external permission, not use anywhere else in app. there way build intent such share image without having have uri? passing bitmap directly, or passing after compressing .png? or there way build uri bitmap held in memory, without first making file? i using now: public void sharescore(string scoretextstring, string scorestring, uri screenshoturi){ intent sharingintent = new intent(android.content.intent.action_send); sharingintent.settype("image/png"); sharingintent.putextra(android.content.intent.extra_stream, screenshoturi); startactivity(intent.createchooser(sharingintent, "share via...")); } public bitmap takescreenshot(gl10 mgl) { final int mwidth = this.getglv

python - How to retrieve tuples from list of string tuples -

a=['(10,13)', '(23,45)', '(56,78)'] here each item in list a string i want other list this: b=[(10,13),(23,45),(56,78)] where each item tuple , each element in each tuple integer. use ast.literal_eval , list comprehension : >>> ast import literal_eval >>> = ['(10,13)', '(23,45)', '(56,78)'] >>> b = [literal_eval(x) x in a] >>> b [(10, 13), (23, 45), (56, 78)] >>>

sql server - How do I create MS SQL tables for a fresh WordPress installation? -

i working on new wordpress site host online bookstore publishing company. .net developer rather use ms sql in combination wp db abstraction ( https://wordpress.org/plugins/wordpress-database-abstraction/ ) plugin. did fresh install of brandoo wordpress ( http://www.microsoft.com/web/gallery/brandoowordpressmssql.aspx ) worked fine. when wanted create copies of database create instances of wordpress ran problems not of details relating tables structure, keys, constraints , default values not copied over. what create table statements need create wordpress related tables in ms sql server? for sql server 2012, following sql script creates needed tables wordpress 3.8.1. use [wordpressdb] go /****** object: table [dbo].[wp_commentmeta] script date: 4/6/2014 5:35:46 pm ******/ set ansi_nulls on go set quoted_identifier on go create table [dbo].[wp_commentmeta]( [meta_id] [bigint] identity(1,1) not null, [comment_id] [bigint] not null, [meta_key] [nvarcha

jquery - Is it possible for blending modes to be applied to text in css/javascript/canvas? -

Image
i prefer css purely fall javascript. if not possible @ how apply effect using canvas tags? heres desired effect: it's bunch of difference blending modes on top of another. if so, possible make work on mozilla? just thoughts on possibilities... a pure css solution spotty far browser support. filter effects some browsers support css image filter effects. you use invert-filter flip black/white. non-rectangular shapes some browsers support css shaping and/or css clip-path. you use define non-rectangular areas on apply invert filter. alternatively you have 2 images 2 modes: black-on-white , white-on-black. you use canvas combine clipping paths, getimagedata , compositing invert colors. you draw text svg. can use clipping isolate b/w vs w/b regions , use fecolormatrix invert colors example svg fecolormatrix: <filter id="matrix-invert"> <fecolormatrix in="sourcegraphic" type="matrix" values="-

android - Rendering GridView inside ListView being slow -

i have listview various types of elements. elements retrieved api, dynamic. 1 of possible elements photo gallery photos must displayed in pairs. i'm rendering element using 2 columns gridview . in other words: 1 of possible listview elements gridview . know isn't practise embed 1 scrollview inside one, it's best approach i've found. there’s problem listview rendering, when reaches gridview , freezes because inflates elements inside gridview regardless going shown in ui. mean, if gridview contains 200 elements, inflates of them. don’t know how make gridview respect common pattern of android groupviews , inflate displayed elements on screen in each particular moment.

Android permissions "com.google.android.googleapps.permission.GOOGLE_AUTH.*" -

i have observed set of android applications requesting permissions starting prefix "com.google.android.googleapps.permission.google_auth.*", such as: com.google.android.googleapps.permission.google_auth com.google.android.googleapps.permission.google_auth.youtube com.google.android.googleapps.permission.google_auth.mail com.google.android.googleapps.permission.google_auth.wise com.google.android.googleapps.permission.google_auth.fusiontables com.google.android.googleapps.permission.google_auth.cp etc. does know if these permissions internal permissions of google apps? or deprecated permissions? intended use third-party apps? thank help. seems "live permission", according androidpermissions.com . site claims list all permissions found on clean android 4.4 emulator . com.google.android.googleapps.permission.google_auth: view configured accounts allows apps see usernames (email addresses) of google account(s) have configured. find f