Posts

Showing posts from February, 2012

java - What declaration turns the below loop into infinite loop? -

place declaration i @ line 3 loop becomes infinite loop. public class puzzel3 { public static void main(string[] args) { // line 3 while (i == + 1) { system.out.println(i); } system.out.println("done"); } } double i=1/0.0; it turn loop in infinite

algorithm - how to find the longest path of increasing numbers in a grid? -

this question has answer here: longest increasing sequence 2d matrix recursion 4 answers assuming have grid: 1 5 7 3 4 9 6 2 8 the solution be: 1-3-4-5-7-9 how solved? i think problem can solved using recursive dp. memoise lenght of longest path obtained starting @ particular point. int dp[rows][cols]={0}; int dfs(int x , int y , int val) { if(dp[i][j] != 0 ) // visited return dp[i][j]; int lengthoflongestpath = 0; search in 4 directions in grid element greater val; // newx, newy,newval lengthoflongestpath = max(lengthoflongestpath , dfs( newx , newy , newval)); lengthoflongestpath ++; // add particular element path dp[x][y] = lengthoflongestpath; return dp[x][y]; } int ans = 0; for(i=0 rows) for(j=0 cols) if(dp[i][j] == 0) // unvisited { dp[i][j] = dfs(i,j,grid[i][j])

asp.net mvc - How to Get a custom header value from an HttpAuthenticationContext -

i busy implementing , authentication filter: public task authenticateasync(httpauthenticationcontext context, cancellationtoken cancellationtoken) { var request = context.request; // receive token client. here example when token in header: var token = request.headers.firstordefault(x => x.key == "token").value.tostring(); //["token"]; how header called token ? because above code doesn't work. guessing because not standard header. request.headers.getvalues("token");

Reading node.js documentation on the command line -

i'm relatively new node , other day when hacking on without 'net connection, wanted read documentation of http module command line. in python or perl, use pydoc or perldoc , name of module want read documentation for, life of me, couldn't figure out how node.js , now, reading online doesn't seem shed light on tiny little brain. so how read (install?) node documentation, particularly non-core modules such angular, particularly if i'm in old farmhouse in middle of , no 'net connection? check out wat , project made above. it's in beta, should public release month, , supports node.js documentation on command line.

Creating a class,for a box. (Java) -

hi had assignment class: implement class named box have following attributes , methods: int length, width, height string color constructor method that: will initialize 3 integers 10, 8, 6 will initialize color “black” a setter , getter method each of 4 attributes a method volume of box a method surface area of box (all 6 sides) i have getters , setters length width , color. problem volume not calculate if set values different. it takes initialized values. ideas go it? code below class. example .setlength(7) , instead of printing total 7*8*6, prints out total of 10*8*6. public class box { private int height = 6; public void se(int height){ this.height=height; } public int getheight(){ return height; } private int width = 8; public void setwidth(int width){ this.width=width; } public int getwidth(){ return width; } private int length= 10; public void setlength(int l

android - Floating EditText on top of Layout -

in xamarin, possible have edittext "floating" on top of layout? i thinking of "bring front" sort of code. currently edittext not showing. here current code: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:padding="5dip"> <edittext android:id="@+id/inputsearch" android:layout_width="fill_parent" android:layout_height="49.1dp" android:hint="find..." android:inputtype="textvisiblepassword" android:layout_marginbottom="15.2dp" /> <framelayout android:id="@+id/mapwithoverlay" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_below=

c# - ASP MVC4 + NHibernate objects in Session -

i need save hibernate object session , retrieve 1 of it's foreign key properties this: public actionresult login(loginmodel model, string returnurl) { user usr = _userrepository.getbyid(convert.toint32(modelstate["user"].value.attemptedvalue)); session["user"] = usr; } public actionresult index() { customer customeractive = session["user"].customer.active; // line throws error: // initializing[myproj.models.customer#3]-could not initialize proxy - no session. } as user.customer foreign key , nhibernate lazy loads it, call fails. how prevent "no session" failure? if want continue existing approach want make sure customer initialized before put session, e.g. var userid = convert.toint32(modelstate["user"].value.attemptedvalue); user usr = _userrepository.getbyid(userid); nhibernateutil.initialize(usr.customer); session["user"] = usr; but... as commentators have hinted there vari

java - 'gomobile.user u' cannot be the first declaration of the FROM clause -

i'm trying query data of user table in schema gomobile of derbydb. i've established connection database , created jpa entity, columns corresponding database table. @entity @table(name = "user", schema = "gomobile") public class user implements serializable { private static final long serialversionuid = 1l; // columns public static list<user> getall() { string querystring = "select u gomobile.user u"; entitymanager em = persistence.createentitymanagerfactory("eclipselink").createentitymanager(); return em.createquery(querystring, user.class).getresultlist(); } } this stracktrace: exception in thread "main" java.lang.illegalargumentexception: exception occurred while creating query in entitymanager: exception description: problem compiling [select u gomobile.user u]. [14, 41] 'gomobile.user u' cannot first declaration of clause. @ org.eclipse.persistence.i

java - Insert "daterange" field value into PostgreSQL table through JDBC -

i have table in postgresql(9.3) daterange field type. i can select field string jdbc, cannot insert in table. what i've tried: preparedstatement stm = conn.preparestatement("insert mytable (my_daterange_field) values (?)"); stm.setstring(1, "[2014-01-02,2014-01-04]"); int = stm.executeupdate(); and got: exception in thread "main" org.postgresql.util.psqlexception: error: column "my_daterange_field" of type daterange expression of type character varying hint: need rewrite or cast expression. position: 168 does have solution inserting daterange? stm.setxxx should use? or maybe cannot because jdbc driver not have daterange support... maybe there third solution? thank you. p.s. my postgresql jdbc driver: <dependency> <groupid>postgresql</groupid> <artifactid>postgresql</artifactid> <version>8.4-701.jdbc4</version> </dependency> use:

Check any fragment is presented in Layout in android? -

in application.there 5 button . when curresponding button pressed fragment load in linear layout.what want if button pressed current fragment in layout should dettach , fragment corresponding button should placed.i need common method remove placed fragment.i know can remove fragment using id.i dont need that.i want common method remove fragments.here java class. button b1, b2, b3, b4, b5; // declare variables actionbar mactionbar; viewpager mpager; fragmentmanager fm; setcontentview(r.layout.activity_main); fm = getsupportfragmentmanager();b1 = (button) findviewbyid(r.id.fbbutton1); b2 = (button) findviewbyid(r.id.fbbutton2); b3 = (button) findviewbyid(r.id.fbbutton3); b4 = (button) findviewbyid(r.id.fbbutton4); b5 = (button) findviewbyid(r.id.fbbutton5); b1.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { fragmenttab1 f1

permissions - See only owner's data in ListAPIView -

i have view deriving listapiview, following permissions: permission_classes = (permissions.isauthenticated, isownerorsuperuser, ) isownerorsuperuse defined such: class isownerorsuperuser(permissions.basepermission): def has_object_permission(self, request, view, obj): return obj.user == request.user or request.user.is_superuser (which similar tutorial) now, when normal user queries view, can see everyone's objects. isn't permission applied every single object in list? how can enforce type of behaviour minimal overhead? thanks no, has_object_permission not applied list , create endpoints, retrieve, update , delete there single instance. filter lists, should use get_queryset filter objects. class bloglist(generics.listapiview): serializer_class = blogserializer permission_classes = (isownerorsuperuser,) def get_queryset(self): user = self.request.user return blog.objects.filter(user=user) to apply further permission

javascript - Google Analytics Link Account Not working -

i have been trying track more 3 sites of mine using single google analytics code. in case have tried track using following code got blog. (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o), m=s.getelementsbytagname(o)[0];a.async=1;a.src=g;m.parentnode.insertbefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); //load plugin. ga('require', 'linker'); // define domains autolink. ga('linker:autolink', ['www.abc.com', 'www.def.com']); ga('create', 'ua-xxx8xxx4-1', 'auto', { 'allowlinker': true, 'cookiedomain': 'none' }); ga('send', 'pageview'); where www.abc.com site have created property in google analytic's account name of "abcpropery" , tracking id against

java ee 7 - How to create a connector for Beanstalkd message queue in Glassfish? -

i have beanstalkd message queue , have glassfish. currenly have created custom connection pool , connection management not work properly. connections left there , it's not managed container (gf4.0). how create proper connector glassfish managed glassfish? hint or link appreciated. in meanwhile developed beanstalkdconnector jca connector. it's freely available @ github: https://github.com/svenvarkel/beanstalkdconnector

.net - Notify multiple background workers with a property change C# -

i have global variable called: string tweet; i run several background workers, nothing wait on value change of tweet variable. run function called: processtweet( object sender, mycustomeventargs args ) my question best way handle property changed event background workers, , later process results based on tweet value , argument passed processtweet function. i tried take @ inotifypropertychanged not sure how handle onvaluechange event each background worker. run same processtweet function once or each background worker run instance of function? edit: private itweet _lasttweet; public itweet lasttweet { { return this._lasttweet; } set { this._lasttweet = value; } } still not sure how handle property change event best way ^ and below rest of code private void bgworker_dowork(object sender, doworkeventargs e) { mycustomclass mycustomclass = e.argument mycustomclass; //here want listen on lasttweet value change event ,

Printing hyperlink in PDF using PDF:Reuse in Perl Catalyst -

trying use pdf::reuse in catalyst produce simple documents. have not found syntax how put http link pdf document in catalyst::view::pdf::reuse modul: http://metacpan.org/pod/catalyst::view::pdf::reuse when looking single pdf::reuse expect use in template syntax: [% pdf.prhyperlink(100, 100, 'press link', 'http://www.test.com') %] but not work. correct syntax put http link pdf using catalyst::view::pdf::reuse ? according documentation of pdf::reuse function adding hyperlink prlink , not prhyperlink. reason template not work?

c# - Android Webview equivalent in Windows Phone 8 app -

i have text html tags in it. example : <i> play football , cricket </i> now when try display text in textblock displays italics tag <i> well. the data present in xml file , working on windows phone 8 application. in android use webview, need use here ? edit i have tried using textblock inlines: italic itltext = new italic(); itltext.inlines.add(new run() { text = "this example text in italics" }); inilinetext.inlines.add(itltext); it works issue here suppose have text below. "this text in <i>italics</i> here" now display entire text in italics. this depends on how content want display. if show large amount of html text, use webbrowser control that. in case have couple of tags i, em, b or strong, can use textblock , have parsing in order convert html suitable xaml components. you have ask how many such controls need display on single page. if answer a few , use webbrowser then. if need display lots o

How to compare an uppercase query with JPA and the QueryBuilder -

how compare uppercase jpa querybuilder? sql: select * person upper(name) = ? and add: searchname.touppercase() here solution: public list<person> getpersonsbyuppername(string searchname) { criteriabuilder cb = em.getcriteriabuilder(); criteriaquery<person> cq = cb.createquery(person.class); root<person> person= cq.from(person.class); path<string> name = person.get("name"); //table column cq.select(person); cq.where(cb.equal(cb.upper(name), cb.parameter(string.class, "nameupper"))); typedquery<person> q = em.createquery(cq); q.setparameter("nameupper", searchname.touppercase());; return q.getresultlist(); } this works input string (dimitri, dimitri, etc.) uppercase conversion performed inside method: table column: cb.upper(name) query parameter: searchname.touppercase() i hope helps.

java - What will be the structure of JSON string inside POST array -

here java program trying send json object server. i'm using apache httpclient http requests , jettison json library. i have few question this. what structure of json string inside post array. {xxxxx:{userid:userid, blha, blha, blha.........}} if need json string (no need convert object) post array in server side. how that? in php echo $_post["xxxxxxx"]; usually there name each data in post array. below program doesnt specify name json object. name(xxxxxxx) below json string inside post array. string base_url = "https://abc.com/"; string username = "test_user"; string password = "test_user_pw"; string client_id = "test_user123"; string client_secret = "test_user1234567"; string login_url = base_url + "session/login"; closeablehttpclient wf_client = httpclients.custom().setuseragent(client_id + "/1.0").build(); httppost login_post = new httppost(loginurl); jsonobject login_object = new

Best design pattern to create navigation based on whether other classes/packages are available (PHP / Laravel) -

we're building new cms our company using laravel. to maintaining code have decided make commonly used pieces of functionality different packages. e.g. blog package, gallery package etc... what i'd ideally admin area able find installed packages of type , build navigation based on provide. what's best way of accomplishing goal - there way of making installed packages register admin package? don't want admin package have go looking other packages. all ideas appreciated. make registration class, make ->registernavigation($controller, $text) item, in sub-packages' service provider ::boot() functions call registernavigation method sub-packages registered in order they're listed in laravel's service providers. of course, have complex or simple you'd like. :)

database - How to open stackoverflow dump data? -

the dump file(s) have received in following format : stackoverflow.com.7z.001 stackoverflow.com.7z.002 ... stackoverflow.com.7z.015 can tell me how open these files? i doing project on data analysis. please use 7-zip unzip it. file format 7-zip extension

java - How to add different JPanel to a JFrame on a JButton click -

i add different jpanel jframe when user clicks on jbutton . the panel must change according button clicked user. here portion of code : addcours.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent arg0) { // todo auto-generated method stub pancours.setbounds(215, 2, 480, 400); pancours.setborder(borderfactory.createtitledborder("saisir les données concernant le cours")); constituerdata.this.getcontentpane().add(pancours); constituerdata.this.revalidate(); constituerdata.this.repaint(); } }); addlocal.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent arg0) { // todo auto-generated method stub panlocal.setbounds(215, 2, 480, 400); panlocal.setborder(borderfactory.createtitledborder("saisir les données concernant le local"))

ios - Overwriting file with DropboxSDK -

i'm using dropboxsdk (core api). upload file function: - (void)uploadfile { [[self restclient] loadmetadata:@"/myfolder"]; } - (void)restclient:(dbrestclient *)client loadedmetadata:(dbmetadata *)metadata { if (metadata.isdirectory) { if (metadata.contents.count == 0) { nsstring *filename = @"file.txt"; nsarray *documentpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdir = [documentpaths objectatindex:0]; nsstring *databasepath = [documentsdir stringbyappendingpathcomponent:filename]; nsstring *destdir = @"/myfolder"; [[self restclient] uploadfile:filename topath:destdir withparentrev:nil frompath:databasepath]; } else { (dbmetadata *file in metadata.contents) { [self overwritefile:metadata]; } } } } i try overwrite file "file.txt&q

Embedded Linux Boot Optimization -

i doing project on pandaboard using embedded linux (ubuntu 12.10 server prebuild image) optimize boot time. need techniques or tools through can find boot time , techniques optimize boot time. if can help. just remove application not required /etc/init.d/rc file put echo after every process initialization , check process taking time starting, if find application taking more time debug application , on.

ios - contentOffset is reset on ScrollView header when vertical scrolling in UITableView -

Image
im making use of code align load of truckdayscrollviews (subclass of uiscrollview) horizontally in uitableview, sudaysfortruckview custom uilabel -(void)scrollviewdidscroll:(uiscrollview *)scrollview { if ([scrollview iskindofclass:[sudaysfortruckview class]]) { cgpoint offset=cgpointmake(scrollview.contentoffset.x, 0); (truckviewcell *cell in self.tableview.visiblecells) { cell.truckdayscrollview.contentoffset=offset; } self.headerview.contentoffset=offset; self.scrollviewposition=offset; } else{ nslog(@"table view scrolling vertically: %f,%f",self.scrollviewposition.x,self.scrollviewposition.y); self.headerview.contentoffset=self.scrollviewposition; } } the idea being, if class of scrolling scroll view part of cell (scrolling horizontally) update scrollviews, including header. works great. although when tableview scrolls vertically, content offset in header scroll view reset 0,0.

php - add two different query in codeigniter -

i want add 2 query not working. here's my model page: public function updatetable(){ $first= $this->db->query("select column1 table table_id='data1' , field_id=6"); // data type numeric. when query this, result 0.0 $second= $this->db->query("select column1 table table_id='data2' , field_id=6"); // data type numeric also. when query this, result 0.0 $total=$first+$second; } when try run got error message message: object of class ci_db_postgre_result not converted int how can make happen or possible? edit: new info i want use $total if statement . if ($total==0){ //code here } what should do? let's see first example in ci userguide: http://ellislab.com/codeigniter/user-guide/database/results.html $query = $this->db->query("your query"); foreach ($query->result() $row) { echo $row->title; echo $row->name; echo $row->body; } we learn 2 things

atk4 - SQLSTATE[HY093]: Invalid parameter number -

this query has been lot of trouble me: /* looking machine attributed site: * - date_started in given period * or - date_ended in giver period * or - date_started before period's end , date_ended null * , - que l'on parle de la même machine */ $dsql = $tmp->_dsql(); $machine = $tmp->selectquery(array('site')) ->where($dsql->andexpr() ->where($dsql->orexpr() ->where('date_started between "' .$dsql->escape($this['date_started']). '" , "' .$dsql->escape($this['date_ended']). '"') ->where('date_ended between "' .$dsql->escape($this['date_started']). '" , "'

c# - Compare Models before and after submission -

i having view accepts model @model mymodel now want serialize model using jquery , store in 1 global variable. now @ time of submission of form want again serialize model. models value might have changed . want latest serialized model compared old model stored in variable. there way compare these models in single line , depending on submit form. code $(document).ready(function(){ var oldmodel=$('form').serialize(); $('form').submit(function(){ var newmodel=$('form').serialize(); if(oldmodel==newmodel)//how can achieve this? e.preventdefault(); }); }) no, none i'm aware of. you'll have write separate function compares each , every field value before submission.

sql server - T-SQL For GRANT View ONLY to Stored Procedures -

how write or grant permission user view stored procedures? don't want users dropping, editing or modifying procs. ok have 2 things achieve looking for. first have create execute role, grant user execute , see stored procedures on database. create role db_executor grant execute db_executor exec sp_addrolemember 'db_executor', 'username' than have give user permission see them in way, described in article grant permissions view stored procedure text grant view definition on yourstoredprocedurename [username]

php - where are the .htaccess file for windows server 2008 R2 -

hi have got problem upload button due file size being big. trying find .htaccess file see if can change max_upload_size . have changed within php.ini file, wanted make sure .htaccess file isn't overiding php.ini file. the server hosting on windows server 2008 r2 , file directory within c$\inetpub\wwwroot\classroom. .htaccess-files apache web server specific thing, not apply on iis. you can check reported value of max_upload_size creating file <php phpinfo(); in , check value is. what message/error getting when trying upload? try find relevant information in iis logs.

objective c - Back swipe gesture is not work when I add the leftBarButtonItem -

here viewcontrollera push viewcontrollerb , , in viewcontrollerb leftbarbuttonitem set following: self.navigationitem.leftbarbuttonitem = [[uibarbuttonitem alloc] initwithtitle:@"back" style:uibarbuttonitemstyleplain target:self action:@selector(backbtnclicked:)]; after setting leftbarbuttonitem , swipe gesture not work. possible keep swipe gesture? because you've changed left bar button item, you're telling navigation controller stop managing navigation-based back-actions user can take. to fix it, can tell navigation controller continue accepting gestures on current view controller using: self.navigationcontroller.interactivepopgesturerecognizer.delegate = self; where self if view controller. uiviewcontroller privately implements uigesturerecognizerdelegate , you'll warning this, can mitigate adding in protocol conformance ( <uigesturerecognizerdelegate> ) header, or class extension.

javascript - Conditionally styling the last element in a knockout.js foreach loop -

i have small chunk of code believe should work, line broken clarity here: <!-- ko foreach: customer.address --> <span data-bind="style: { display: $index() === ($parent.data().length -1) ? 'inline-block' : 'block' }, text: $data.text"></span> <!-- /ko --> my aim here loop around printing out span elements, of set display: block , last set display: inline-block . not appear matter how bracket conditional, doesn't work , returns error: uncaught typeerror: unable process binding "foreach: function (){return customer.address }" message: unable process binding "style: function (){return { display:$index() ===($parent.data().length -1) ?'inline-block':'block'} }" messag...<omitted>...a' modifying conditional otherwise evaluates true fine, e.g. `display: (1 === 1) ? 'inline-block' : 'block'. of note conditional check last element ok, u

Can using multiple triggers cause performance issues? -

using formranger form/google spreadsheet, have 3 triggers: on every form submit; on every spreadsheet edit; , every 5 minutes. using 3 cause conflicts and/or slowness of google form/spreadsheet (form responses)? thanks much! no, parallel triggers not cause performance issues. each invocation run in it's own copy of spreadsheet, , there no direct interaction between them. all scripts contribute towards daily service limits.

How to validate the value of an input field using mootools (value must be 8) -

hope can give me hint... i have work mootools , have form. 1 of input fields valid if value number 8. has idea how this? best regards, dan if post html of input can better. otherwise: var element = document.getelement('input'); //or var element = $('inputid'); //or var element = document.queryselector('input'); then use element.value == 8 or element.get('value') == 8 you can check here mootools docs as @dimitar pointed out , didn't mention, need listen submit of form , use code check input value. example: var form = $('myform'); form.addevent('submit', function (e) { // attach event form e.stop(); // prevent being submited var input = this.getelement('input'); // input element if (input.value != 8) { // verify value alert('the value not 8'); // inform user return false; // end function

android: increase width width of quotespan strip -

i using quotespan textview spannablestring t1 = new spannablestring(html.fromhtml(myitems.get(position).gettest())); t1.setspan(new quotespan(color.red), 0, t1.length(), spannable.span_paragraph); txtview1.settext(t1); but displays very thin line on left of text, there way make line thicker looks better?

java - Why Primitive Data types are fixed with their memory? -

my question: why primitive data-types fixed in size? how can collections grow in size dynamically? suppose, primitive data-types contain feature or ability grow in size dynamically. reduce data-types 8 4 " integer " group of integer, float, short, long , float group of float, double. why isn't structure way? any answer full. in advance. hardware primitives have defined size, otherwise you'd have difficulties memory layout, converting bytes primitives , vice versa, etc. software primitives (built-in datatypes provided language) might not need fixed size make memory operations , data transfer more complex operations. as example, if read integer file, how many bytes read? 1,2,4,8? in memory you'd have similar problem: if object consist of 2 short integers, i.e. 2x2 bytes, you'd need move second integer if first needed grow or move entire object. performance penalty wouldn't compensated comfort of having 1 integer type. collection

machine learning - More accurate approach than k-mean clustering -

in radial basis function network (rbf network), prototypes (center vectors of rbf functions) in hidden layer chosen. step can performed in several ways: centers can randomly sampled set of examples. or, can determined using k-mean clustering. one of approaches making intelligent selection of prototypes perform k-mean clustering on our training set , use cluster centers prototypes. know k-mean clustering caracterized simplicity (it fast) not accurate. that why know other approach can more accurate k-mean clustering? any appreciated. several k-means variations exist: k-medians, partitioning around medoids, fuzzy c-means clustering, gaussian mixture models trained expectation-maximization algorithm, k-means++, etc. i use pam (partitioning around medoid) in order more accurate when dataset contain "outliers" (noise value different others values) , don't want centers influenced data. in case of pam center called medoid.

javascript - how to get data of checked multiple check boxes into js using onclick in php -

here code need fix here ad_q_type field name of db , ad_q_ans_options field of db contains answers in concatenated comma if($questions['ad_q_type'] == 1 && strpos($questions['ad_q_ans_options'],',') == true) { if($questions['ad_q_option1'] != "") { echo '<input type="checkbox" id="cleponlineexam_check1_'.$current_qno.'" class="css-checkbox lrg" name="op[]" value="1" onclick="toggle(this.id,1)"; />'; echo '<label for="cleponlineexam_check1_'.$current_qno.'" name="checkbox67_lbl" class="css-label lrg web-two-style">[a] '.$questions['ad_q_option1'].'</label>'; echo '<div class="clear"></div>'; } if($questions['ad_q_option2'] != "

.net - how to create nested node C# -

i have developing json feed using sql database. have used below code project responce public string convertdatatabletostring() { datatable dt = new datatable(); sqlconnection connection = new sqlconnection(configurationmanager.connectionstrings["dbconnection"].tostring()); sqlcommand command = new sqlcommand("select * table4", connection); sqldataadapter da = new sqldataadapter(command); da.fill(dt); javascriptserializer serializer = new javascriptserializer(); list<dictionary<string, object>> rows = new list<dictionary<string, object>>(); dictionary<string, object> row; foreach (datarow dr in dt.rows) { row = new dictionary<string, object>(); foreach (datacolumn col in dt.columns) { row.add(col.columnname, dr[col]);

ios - Delete Project in Bot -

Image
i knew how delete bot project in xcode , have problem , if xcode project not exist anymore , how should delete project in bot ? i have 2 test projects in xcode bot, not exist in our git server , xcode project files deleted .... how should delete project in bot ? i solved it. ha ha ....in bot webpage upper right

android - java.lang.RuntimeException: Unable to start activity ComponentInfo {...}: java.lang.NullPointerException -

when click go 1 activity another, have error: java.lang.runtimeexception: unable start activity componentinfo {...}: java.lang.nullpointerexception i missing method? please me understand did wrong, why see error? my activity: zaselenie.java import java.util.arraylist; import android.app.activity; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.os.bundle; import android.util.log; import android.widget.arrayadapter; import android.widget.spinner; public class zaselenie extends activity { contactdbmoy cqh; kvartdb kdb; sqlitedatabase sdb; private long rowid; spinner spzaselenie; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.zaselenie); spzaselenie = (spinner)findviewbyid(r.id.spzaselenie); // Инициализируем наш класс-обёртку cqh = new contactdbmoy(zaselenie.this); kdb = ne

c# - Redraw dependent select list on client side -

i have 2 dimentional array model view: public class mydata { pubic ilist<source> sources { get; set; } .... } public class source { public string parentname { get; set; } public ilist<string> childnames { get; set; } } it 5 parents , each of them has 10 childs. on page need show 2 lists: first contain parents , second contain selected parent childs. <select id="parents"> @foreach (var source in model.sources) { <option>@source</option> } </select> <select id="childs"> </select> sources have formed @ once on server side , never modifed. best practice show these lists? redraw child list on client side? how model view javascript(jquery)? somthing c# code: model.sources.firstordefault(s => s.parentname == selectedvalue) into change event handler: $("#parents").change(function () { var selectedvalue = $("#parents").val();

r - Custom output hooks in knitr -

i trying create chunk hook can produce \floatfoot{} part of output chunk. hopefully following example makes clear trying achieve: 1. .rnw file here knitr file. \documentclass[a4paper]{article} \title{learn moar knitr!} \author{foo bar} \date{\today} \usepackage{blindtext} \usepackage{floatrow} \begin{document} \blindtext <<label=plotwithnotes, fig.lp='fig:', fig.cap='this figure'>>= plot(rnorm(100), rbinom(n = 100, size = 1, prob = 0.5)) @ \end{document} 2. latex chunk \begin{figure}[] \includegraphics[width=\maxwidth]{figure/plotwithnotes} \caption[this figure]{this figure\label{fig:plotwithnotes}} \end{figure} 3. floatfoot the markup \floatfoot{} provided floatrow package produces footnote graph, , show use, modify latex chunk above. \begin{figure}[] \includegraphics[width=\maxwidth]{figure/plotwithnotes} \caption[this figure]{this figure\label{fig:plotwithnotes}} \floatfoot{\emph{note:} footer plot , contains information plot.}

database - Required help in a query -

i wanted take count of records based on condition. here's condition is. data: "col1" "col2" "col3 y y y y n y n y n y y y n y b y n b y y b n y b n n b y y b n y c y n c y y c n y c y y c n y c y y i need take count of y col3 excluding n of col2 col1 value a . head cracking when think of doing it. note : n values of col2 must excluded col1 value a. null values need included along y passing criteria col3 value y . please me. i need count 11 if query correct. code tried with. select 'yes' "label", count(*) table1 "date" between '2014-03-01' , '2014-03-05' , "col3" = 'y' , ("col1" 'c' , "col2" 'n') i have idea how orally. couldn't figure out way in postgresql . try this: select 'yes' "label",

sdk - Is it possible to Develop Apps for multiple Smart TV using any single platform -

is possible develop single app multiple smart tv ? looking forward develop app multiple smart tvs using single ide / platform. there library allows start 1 application on few smarttv platforms. called smartbox. look @ this: https://github.com/immosmart/smartbox

php - Wordpress, is it possible to add custom parameters to shortcode any widget -

i'm using shortcode widget plugin. possible send attributes widget called shortocde. this [do_widget name="category viewer" maxcount=5] where maxcount parameter should used in category viewer widget. you can check attributes "shortcode widget" shortcode uses looking @ following code plugin: extract(shortcode_atts(array( 'sidebar' => 'widgets shortcodes', 'id' => '', 'name' => '', /* mkm added explicit 'name' attribute. existing users still need allow prev method, else many support queries happen */ 'title' => '', /* default title unless ask not - use string here not boolean */ 'class' => 'amr_widget', /* widget class picked automatically. if want add additional class @ wrap level try match theme, use */ 'wrap' => '' /* wrap whole thing - title plus widget in div - maybe

MongoDB 3-level aggregation -

suppose have list of schools each school assigned city, state (province) , country. is possible build aggregated list of unique cities/states/countries mongodb aggregation framework? what have: [ { "school_name” : "school #1", "state" : "ca" "city” : "san-francisco", "country” : "usa", }, { "school_name” : "school #2", "state" : "ca" "city” : "san-francisco", "country” : "usa", }, { "school_name” : "school #3", "state" : "ca" "city” : "los angeles", "country” : "usa", }, { "school_name” : "school #4", "state" : "co" "city” : "denver", "country” : "usa", }, { "school_name” : "school #5", "state" : "co" "city

Get the function name from it's body in Ruby -

this question has answer here: get name of executing method 5 answers say have function: def foo() puts getfunctioniamin() end i want output be:"foo" , if have code: def foo1() puts getfunctioniamin() end i want output be:"foo1" just write below using __method__ : def foo() puts __method__ end above correct, __callee__ sounds more technically correct. __method__ returns defined name, , __callee__ returns called name. they same usually, different in aliased method. def foo [__method__, __callee__] end alias bar foo p foo #=> [:foo, :foo] p bar #=> [:foo, :bar]

html - How to make screen readers read C/F as Celsius/Fahrenheit? -

i have simple webapp bunch of recipes , i'm trying make accessible people use screen readers. often cooking temperature denoted c (for celsius) , f (for fahrenheit). screen readers read these letters , thought bit confusing, talking temperatures. my goal maintain sentence this: <p> turn oven on 350 f </p> . unfortunately, screen readers read as: "turn oven on 3 hundred , fifty f" . i screen readers pronounce so: "turn oven on 350 degrees fahrenheit" is possible somehow indicate screen readers how read specific letters or words? achieveable using aria notation or should have hack have invisible sentence: <p> turn oven on 350 degrees fahrenheit </p> it should denoted °c (and °f until usa joins other countries of planet ^^). kelvin degrees written without ° should screen readers understand it's unit, though didn't test those. otherwise @boby212 solution abbr element wcag 2.0 technique: providing

java - My interface when triggered get NullPointerException -

i try toast message interface. if app not connection internet, want show toast message , i'm wanting java interfaces. this motheractivity.java . file implement toastmessagges.toastmessaggecallback public class motheractivity extends actionbaractivity implements toastmessagges.toastmessaggecallback { toastmessagges toastmessagges; @override protected void onstart() { super.onstart(); } @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_mother); toastmessagges = new toastmessagges(); appstarter(); } private void appstarter(){ boolean checkinternet = internetcontrol.checkinternetconnection( getapplicationcontext() ); if( checkinternet ) { toastmessagges.show_toast_messagge(); } else {

mysql - ActiveRecord::ConnectionNotEstablished getting started with Ruby on Rails -

i absolutely new ruby on rails , i'm following book that's written tutorial, bit outdated. when run server , browse localhost:3000 not working right, following error: activerecord::connectionnotestablished mysql installed in computer, databases created , of works in other example applications have been giving to. this databases.yml file: development: adapter: mysql2 database: emporium_development username: emporium password: hacked test: adapter: mysql2 database: emporium_test username: emporium password: hacked i made sure mysql2 gem installed this: gem install mysql2 shed light on me please. first setup gems running bundle install then database needs created: rake db:create if have pending migrations (and if don't can still run, won't anything): rake db:migrate this should setup database works, provided gave correct password. note if have database want rid of, can run rake db:drop and try create database ag

java - Android Notification and NoSuchMethodError -

i build notification: notification.builder builder = new notification.builder( getapplicationcontext()) .setticker( getapplicationcontext().getstring( r.string.my_string)) .setsmallicon(android.r.drawable.sym) .setcontenttitle( getapplicationcontext().getstring( r.string.my_string_two)) .setcontenttext(a.getb()) .setsound( ringtonemanager .getdefaulturi(ringtonemanager.type_notification)) .setvibrate(new long[] { 10001000 }) .setautocancel(true) .setcontentintent(pendingintent.getactivity(getappli

php - Website to display and filter data from MySQL Database -

i need create website display information mysql database on same server, have no idea start. i have a: mysql database. contains 1 table information on items added on particular date. information includes, title, location , date item added. i need to: create website front end allow me filter particular date , display title , locations of devices checked on date, preferably in table format. i running apache/php/mysql web server on same machine , know how return data via json using php, have no idea how manipulate website format? i assume start allowing user select list of avaliable dates somehow, use selection perform "select * 'added_devices' date=?", returns {"title":bob,"location":london,"date":20/11/03}, {"title":bill,"location":manchester,"date":18/12/05}, any appreciated, no idea start! from i've learned in question, should have @ phpmyadmin , web gui mysql, written on php.