Posts

Showing posts from April, 2012

Generating a deck of cards in C -

i need assignment. supposed generate , print 52 cards, i'm having trouble understanding how print "ace", "2".....etc. for(i=0; < 52; i++) { if(i%13==0) { printf("card %2d = king %s\n", i,suits[i/13]); } else if(i%13==1) { printf("card %2d = ace %s\n", i,suits[i/13]); } else if(i%13==11) { printf("card %2d = jack %s\n", i,suits[i/13]); } else if(i%13==12) { printf("card %2d = queen %s\n", i,suits[i/13]); } else { printf("card %2d = %2d %s\n", i, i%13, suits[i/13]); } } another solution adding more condition loop "king" "ace" "jack" , "queen"

text box not working proper in contact form7 wordpress in chrome -

i using contact form 7 in wordpress. basically, have text input. facing weird issue on input box. behaviour happens in chrome (i using version 16.0.2). to reproduce issue: place focus/cursor in input box , type few characters without taking focus out of box, again click inside text-input box try entering further text there nothing displaying when hover text box contain display in text box.. again click in text box , trying type thing nothing act without out text box.. please me .. remove float of text box. .slider .form input { float: none !important; }

java - Using Embedd class or storing foreign keys for a Google Datastore? -

this best practice question regarding google datastore. i'm trying build object relationships , i'm seeing 2 options directly embed child class @persistent in parent class using google key class , store own foreign keys strings in related classes third option not available, jdo join app engine not support join queries: cannot query parent entity using attribute of child entity. (you can query property of embedded class, because embedded classes store properties on parent entity. see defining data classes: embedded classes.) my worry using option 1 simple search query return unneeded data. example being product class , productdetail class. when customer searches products searching based on category, name , sorted price. of simple info in product class. in productdetail class hold large description strings, links images, lists of key attributes. in product class embed productdetail class or create foreign key property holds key value of productdetail cl

mysql - how to get the passed value data from the database and show in a html table using php -

i have database , have table named supplier .it contains different columns region,country,9xx,10xx . i fetching 9xx,10xx columns in drop down.when user select of them,selected value go to page mysql query performed , result shown in html table. the problem not geting records database passed values(i.e supplierid : 10xx or 9xx) ,please see code <?php $dbhost = 'localhost'; // localhost $dbusername = 'xxxxxxxxx'; $dbpassword = 'xxxxxxxxxx'; $dbdatabase = 'xxxxxxxxxxx'; $db = mysql_connect($dbhost, $dbusername, $dbpassword) or die ("unable connect database server."); mysql_select_db ($dbdatabase, $db) or die("could not select database."); $supplierid = $_get['supplier_id']; //supplierid 10xx or 9xx $sql = "select region,country,$supplierid supplierprice order country asc "; $sql_select = mysql_query($sql); while($rows=mysql_fetch_array($sql_select))

Is com.google.android.c2dm.intent.REGISTRATION deprecated? -

short version: intent com.google.android.c2dm.intent.registration still used @ or has been deprecated gcm? longer version: google's gcm-demo-client declares intent in filter, however, if follow same procedure, valid registration id when call gcm.register() , then , broadcast receiver receives additional registration id because of registration filter, , second registration id bogus (i can't send notification it). at point, i'm considering removing registration filter (and keeping receive ) want make sure i'm not missing important in protocol. you looking @ older version of official google demo. current version doesn't use com.google.android.c2dm.intent.registration , can see here: <receiver android:name=".gcmbroadcastreceiver" android:permission="com.google.android.c2dm.permission.send" > <intent-filter> <!-- receives actual messages. --> <action andro

How can I access multiple content in webview in android -

i trying use webview. use ourbrow.loadurl("https://www.google.com/finance/chart?client=firefox-a&rls=org.mozilla:en-us:official&channel=sb&biw=1366&bih=390&q=+val[from]+val[to]+&tkr=1&p=5y&chst=vkc&chs=229x94&chsc=1&ei=vyuxu7j6jaxq0qgh3og4cq"); logcat : 03-06 12:50:27.551: d/adnan(14485): android.webkit.webview{413ab878 vfedhvcl ........ 156,340-456,640 #7f0a0010 app:id/chartwebview} if use ourbrow.loadurl(" https://www.google.com/finance/chart?client=firefox-a&rls=org.mozilla:en-us:official&channel=sb&biw=1366&bih=390&q=currency:bdthkd&tkr=1&p=5y&chst=vkc&chs=229x94&chsc=1&ei=vyuxu7j6jaxq0qgh3og4cq "); then ok... need use dynamic data not fixed one. you have wrongly written it.. you can use : "static_part"+dynamic_part+" so need write : ourbrow.loadurl("https://www.google.com/finance/chart?client=firefox-a&rls=org.

How to get NEST to work with Proxy, like Fiddler -

i'm trying pass elasticsearch calls nest through fiddler can see actual json requests , responses. i've done following create client, requests not being pushed through proxy (it doesn't matter if fiddler on or off, request still gets elasticsearch). connectionsettings cs = new connectionsettings(uri); cs.setproxy(new uri("http://localhost:8888"),"username", "password"); elasticclient = new elasticclient(cs); fiddler has no username/password requirements pass random text. i can confirm @ point before executing request elasticclient has proxy property filled in uri specified above, though trailing slash added nest. thanks okay, so, gave on nest proxy settings - didn't seem make difference. however, setting host on nest client " http://ipv4.fiddler:9200 " instead of localhost routes call through fiddler , achieved desired result of allowing me see both requests , responses elasticsearch.

python - Memory usage in creating Term Density Matrix from pandas dataFrame -

i have dataframe save/read csv file, , want create term density matrix dataframe it. following herrfz's suggestion here , use counvectorizer sklearn. wrapped code in function sklearn.feature_extraction.text import countvectorizer countvec = countvectorizer() scipy.sparse import coo_matrix, csc_matrix, hstack def df2tdm(df,titlecolumn,placementcolumn): ''' takes in dataframe @ least 2 columns, , returns dataframe term density matrix of words appearing in titlecolumn inputs: df, dataframe containing titlecolumn, placementcolumn among other columns outputs: tdm_df, dataframe containing placementcolumn , columns words appearrig in df.titlecolumn credits: https://stackoverflow.com/questions/22205845/efficient-way-to-create-term-density-matrix-from-pandas-dataframe ''' tdm_df = pd.dataframe(countvec.fit_transform(df[titlecolumn]).toarray(), columns=countvec.get_featur

codeigniter - How to import data from excel to mysql database using php -

i using phpexcel import xlsx file related database. while running function getting error. code looks shown below. controller: <?php if (!defined ('basepath')) exit ('no direct access allowed'); class excelcontroller extends ci_controller { public function index() { //load library excel $this->load->library('excel'); //here used microsoft excel 2007 $objreader= phpexcel_iofactory::createreader('excel2007'); //set read $objreader->setreaddataonly(true); //load excel file $objphpexcel=$objreader->load('data.xls'); // error in line $objworksheet=$objphpexcel->setactivesheetindex(0); //load model $this->load->model('user_model'); //loop first data untill last data for($i=2;$i<=77;$i++) { $name= $objworksheet->getcell

javascript - Problems with adding input field to div -

i tried add input field, , label card (the user add card via button). didn't succeed. instead of adding these input field card, put them on in-box list. can me solve problem? fiddle $('document').ready(function () { $('#addcardbtn').click(function () { var numberofdiv = [100]; with(document) { var newdiv = createelement('div'); var div = getelementbyid('useraddeddiv').appendchild(newdiv); (var = 0; < numberofdiv; i++) { numberofdiv[i] = div; } } }); $(function () { $('#useraddeddiv').sortable({ containment: 'document', cursor: 'crosshair', opacity: '0.70', connectwith: '#onholdlist', hoverclass: '.border' }); $('#onholdlist').sortable({ containment: 'document', cu

r - Could not establish handwhake with twitteR -

i'm trying use twitter package r. so, i'm trying establish handshake code : requrl <- "https://api.twitter.com/oauth/request_token" accessurl <- "http://api.twitter.com/oauth/access_token" authurl <- "http://api.twitter.com/oauth/authorize" twitcred <- oauthfactory$new(consumerkey=mykey, consumersecret=mysecret, requesturl=requrl, accessurl=accessurl, authurl=authurl) twitcred$handshake() this gets me error : error in function (type, msg, aserror = true) : couldn't connect host since i'm behind proxy, suspect cause troubles. however, configured r (i can download packages without troubles). consequence, i'm little stuck.

c++ - DTracing objc_msgSend doesn't print the receiver class name -

i using dtrace print objc_msgsend in code. i've done far can see selector's name cannot correct class name. this dtrace script: #!/usr/sbin/dtrace -qs pid$target::objc_msgsend:entry { self->isa = *(long *)copyin(arg0, 8); printf("-[%s %s]\n", copyinstr(*(long *)copyin(self->isa + 16, 8)), copyinstr(arg1)); } and assuming the id receiver object of following struct: typedef struct objc_class { struct objc_class *isa; struct objc_class *super_class; char *name; ... } in head, in order reach name pointer has moved 2 * sizeof(objc_class*) makes 16, , pointer of name of size 8. therefore expected see class name garbage printed instead. any ideas of doing wrong? my system mavericks x64. after poking around obj-c runtime source code 64 bit architecture , "objc-private.h" file, "formula" class name class pointer: #define rw_realized (1<<31) #define rw_future (1<<30) #define cl

pug - Jade spacing breaking buttons? -

i'm programming buttons in jade, , i'm little confused how spacing works. the top example functions, leaves buttons close together. the second example (with added space before " a(href ") breaks link while spacing buttons properly. is jade sensitive spacing? can tell me whats going on here? div.sub-menu div.wrapper a(href="#/microsite/a") input(type="button", class="button white-button", value="a" ) a(href="#/microsite/p") input(type="button", class="button white-button", value="p" ) div.sub-menu div.wrapper a(href="#/microsite/a") input(type="button", class="button white-button", value="a" ) a(href="#/microsite/p") input(type="button", class="button white-button", value="p" ) yes, jade sensitive spacing. spacing determines nesting of each tag. so, fo

jquery - How to use div element to show google maps? -

i learning basics of google maps api. facing issues in implementing template. i use <div class=container> <!-- put here --> <div id='canvas'></div> <!-- doesn't work --> </div> but put <!--i put here, it's work --> <div id='canvas'></div > <div class=container> </div> how should it? you need quote class: <div class="container"> <!-- put here --> <div id='canvas'></div> <!-- doesn't work --> </div>

Multi tenancy for spring security -

how can apply spring security multitenant web application? web application has supported multi-tenants i.e http://:/springapp/appollo---uses ldap authentication http://:/springapp/fortis----uses local database authentication http://:/springapp/manipal---uses oath authentication how can apply spring security supports tenants it might trivial, though not simple case... basically, need create (spring) filter in webapp, catch requests, , subdomain of referrer decide authentication method use (it can achieved simple table in db, map subdomain enum, e.g. 'oauth', 'saml', 'local', etc. filter should placed before other authentication filter, , said , technically decide auth method use. i had tackle kind of scenario, , best solution - far think - support 1 authentication method, , creating "bridge" other authentication methods, needed. example, main authentication method oauth2.0. then, in cases need other types of authentication, create &

android - EditText inside ExpandableListView is not expanding the childs -

i have created expandablelistview following tutorial http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/ working fine. there have 2 textview in parent group. when adding edittext in parent group it's showing in listview after clicking on parent it's not expanding. assume it's due focus on edittext . please find way focus on parent item clicking expands , shows child items. on other hand when try write in edittext should focus on without expanding listview . here code: package com.sifb.icms.sit.application.adapter; import java.util.arraylist; import java.util.hashmap; import java.util.list; import com.sifb.icms.sit.r; import com.sifb.icms.sit.object.object_cateringmenu; import android.content.context; import android.graphics.color; import android.graphics.typeface; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseexpandablelistadapter; import android.widget.editt

copying date with milliseconds in excel vba -

i copy exact date contained in 1 cell cell. use command: range("e" & ii).value = range("c" & ii).value but date format missing milliseconds despite having column formatted using: columns("e:e").select selection.numberformat = "dd/mm/yyyy hh:mm:ss.0" i "0" millisecond in e column despite having millisecond value in c column. thanks , regards use format: "dd/mm/yyyy hh:mm:ss.000"

javascript - angularjs submit within Bootsrap Modal -

i have bootstrap 3 modal containing list of items choose from, list populated via angular. when click on item in list, populate hidden field hold chosen values using bit of js, see below. hidden fields tied $scope. when submit form, items not passed. have seen number of comments suggest need refer parent scope, e.g. ng-model="$parent.description", not seem work either. suggestions? $scope.openfavsmodal = function () { var url = "/getfavs/"; $http.get(url) .success(function (data) { $scope.mydata = data; $('#addfavsmodal').modal('show'); }); }; <form class="form-horizonatal" ng-submit="insertfavourite()" id="frmaddfav"> <div class="modal fade" id="addfavsmodal" tabindex="-1" role="dialog" aria-labelledby=&

windows phone 8 - ResourceDictionary with Caliburn Micro -

app.xaml <application.resources> <local:appbootstrapper xmlns:local="clr-namespace:kyms" x:key="bootstrapper" /> <local:localizedstrings xmlns:local="clr-namespace:kyms" x:key="localizedstrings"/> <resourcedictionary x:key="customdictionary"> <resourcedictionary.mergeddictionaries> <resourcedictionary source="styles/styles.xaml" /> </resourcedictionary.mergeddictionaries> </resourcedictionary> </application.resources> my resource in styles/styles.xaml <resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"> <style x:key="mycolorbutton&quo

checksum - Java Code for CRC 128 bit -

i need compute crc 128 bit checksum strings extracted documents. i looking around on internet cant find pseudo code or java code. so can me? thanks attention. the wikipedia article on computation of crc-checksums contains explanations on crc algorithms , shows pseudocode well http://en.wikipedia.org/wiki/computation_of_cyclic_redundancy_checks

c# - asp.net and javascript please advise -

i new javascript , having problems. my mission create mouseover , mouseout script having difficulty with, my aspx code <div> <div id="div_img" style="height: 300px; width: 300px; border: solid 1px black; position: absolute; visibility: hidden;"> <img src="" id="img_tool" /> </div> </div> <script type="text/javascript" language="javascript"> function showtooltip(con) { console.log(getoffset(con).left + '-' + getoffset(con).top); document.getelementbyid("div_img").style.visibility = "visible"; document.getelementbyid("img_tool").src = con.src; document.getelementbyid("div_img").style.left = getoffset(con).left - 300 + 'px'; document.getelementbyid("div_img").style.top = getoffset(con).top - 300 + 'px'; do

scala - column Name of LongType instead of Utf8Type in cassandra cli column family -

i new @ cassandra cli, want know is practice define columns name longtype instead of utf8type , please tell me there wrong in code or coding style? i doing in scala in playframework hector. val mutator = hfactory.createmutator(group, le); mutator.addinsertion(groupid,"grouprefrence",hfactory.createcolumn(userid,userid,le,le)) mutator.execute() def getmembersrefrence(groupid: long) = { val slicequery = hfactory.createslicequery(group, le, le, le) slicequery.setcolumnfamily("grouprefrence") slicequery.setkey(groupid) slicequery.setrange(long.min_value,long.max_value, false, integer.max_value) val result = slicequery.execute() val res = result.get() val columns = res.getcolumns() val response = columns.tolist response } good practice define columns name longtype instead of utf8type you should define column name datatype whatever makes sense data model. far best practices go, ebay posted tech blog on couple of years ago, , read. part 2 c

how to include third framework on robovm ios? -

we developing game on robovm ios, easy include system framework in robovm.xml. how include third framework on robovm ios? information appreciated!! specify path of framework using <frameworkpaths> element in robovm.xml file. below example googleplus framework. assumes google-plus-ios-sdk-1.4.1 folder located in same folder robovm.xml file. <config> ... <frameworkpaths> <!-- relative path folder containing googleplus.framework folder --> <path>google-plus-ios-sdk-1.4.1</path> </frameworkpaths> <frameworks> <framework>googleplus</framework> </frameworks> ... </config> also note may have add <resource> robovm.xml file if framework includes image files , other resources have included in application.

With Ehcache and spring what happens if a load balanced server become unavailable? -

i'm working on web app ehcache deployed. app load balanced between multiple servers. app installed on each server , when user accesses app he/she redirected 1 of load balanced servers. is understanding of following correct? if user makes request key , it's annotated @cacheable check made value in ehcache store. if key in store value returned ehcache, if key not in store key , value added store , value returned. if 1 of load balanced servers becomes unavailable , user requests value has been cached in now-unavailable server new value added cache store , returned user described above. there no risk of user requesting key not available, there? i don't understand mean a key not available . essentially, spring caching abstraction works more or less described. spring delegates actual caching business configured caching library. in case, ehcache. if have 1 cache per node, each node have copy of data. if 1 server goes down , user requests not yet in server

c# - Compressing a bitmap with Run Length Encoding [RLE] using GDI+ -

i tried lot searching on google before posting question here. want compress 8bpp bitmap using rle [run length encoding] compression in win forms application. of results found vc++ code, can perform compression using gdi+ ? gdi+ provide such classes or methods ? found 1 link on msdn doesn't helped much. also, tried write below code using "system.drawing.imaging.encoder" output image has same size. private void button1_click(object sender, eventargs e) { bitmap mybitmap; imagecodecinfo myimagecodecinfo; encoder myencoder; encoderparameter myencoderparameter; encoderparameters myencoderparameters; // create bitmap object based on bmp file. mybitmap = new bitmap("d:\\8bppimage.bmp"); // imagecodecinfo object represents bmp codec. myimagecodecinfo = getencoderinfo("image/bmp"); // create encoder object based on guid // compression parameter category. myencoder = encoder.compression; // cre

regex - Regular Expression Split XML in Java -

i want split xml text parts: xmlcontent = "<taga>text1<tagb>text2</tagb></taga>"; in c# use string[] splitedtexts = regex.split(xmlcontent, "(<.*?>)|(.+?(?=<|$))"); the result splitedtexts = ["<taga>", "text1", "<tagb>", "text2", "</tagb>", "</taga>"] how can in java? i have tried string[] splitedtexts = xmlcontent.split("(<.*?>)"); but result not expecting. the parameter split defines delimiter split at. want split before < , after > hence can do: string[] splitedtexts = xmlcontent.split("(?=<)|(?<=>)");

java - Junit tests are bringing weird errors on server startup (logger.DEBUG) -

we have tomcat spring web app. have lots of junit tests. when set logger value "debug" tons of following errors: 06 mar 2014 12:16:39 trace classpathscanningcandidatecomponentprovider - scanning file [d:\workspaceng\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\ng\web- inf\classes\com\xxx\testing\baserollbacktest.class] 06 mar 2014 12:16:39 debug annotationattributesreadingvisitor - failed classload type while reading annotation metadata. non-fatal error, annotation metadata may unavailable. java.lang.classnotfoundexception: org.junit.after @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1702) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1547) @ org.springframework.core.type.classreading.recursiveannotationattributesvisitor.visitend(annotationattributesreadingvisitor.java:171) @ org.springframework.asm.classreader.a(unknown source) @ org.springframework.asm.classreader.accept(unknow

docusignapi - is there any way to create a template using docusign api -

i using rest api (in php-codeigniter) docusign. creating templates demo.docusign.net. there api call create docusign template site uploading document ? yes, the verb post , uri {vx}/accounts/{accountid}/templates documentation here the docusign rest api operations @ https://www.docusign.net/restapi/help# also endpoint information covered in other stack overflow question what wsdl url use soap using sandbox account? the docusign online documentation @ https://docs.docusign.com/esign

wpf - RichTextBox with diagonal text lines -

i want have customized richtextbox control use in application ms word. challenge input text diagonally. used richtextbox , texteffect runs in document property of richtextbox show text diagonally , works. unfortunately caret appears in original position , direction user confused edits, types , selects. can me? <style targettype="run"> <setter property="texteffects"> <setter.value> <texteffectcollection> <texteffect positioncount="99999"> <texteffect.transform> <transformgroup> <scaletransform/> <skewtransform/> <rotatetransform angle="30"/> <translatetransform x="30" y="0"/> </transformgroup> </texteffect.transform> </texteffect> </texteffectcollection> </setter.value>

Parsing XML from SOAP response with jQuery -

i have problems parsing response soap server jquery. this request post /remedifinderservices/hswebservice.asmx http/1.1 host: 192.168.1.24 content-type: text/xml; charset=utf-8 content-length: length soapaction: "http://www.healthsprint.com/newuserregistration" <?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <newuserregistration xmlns="http://www.healthsprint.com"> <loginid>string</loginid> <password>string</password> </newuserregistration> </soap:body> </soap:envelope> and response http/1.1 200 ok content-type: text/xml; charset=utf-8 content-length: length <?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:xsi="http:/

c# - Create XML using an .xsd file inC# -

this question has answer here: generating xml file using xsd file 2 answers how create xml file using xsd file in c#? want write program fetch xsd file, fill elements , save xml file. the xml schema supposed describe schema of xml file. in order create xml file according specific xsd , cannot using xsd. need data too... cannot made automatically. have somehow add data question. hope helped!

What data I will get in global $user; used in hook_node_update when drupal 7 cron executes -

i have implemented hook_node_update in module. can access loggedin user data defining global user object global $user; . need know loggedin user , content creator process instructions. the question if node scheduled unpublished , when drupal runs cron in global $user; ? same user made change in node or else? there way access data of user last updated node? update: i think failed explain need. consider scenario. there 2 users, , b. created content (node) example . when b changes in example need send email notification a. when example content scheduled archived user b, cron task saved , executed cron. when cron runs, @ point how can know scheduled b? the global $user object always: an object representing user visiting site. that can either authenticated user, or anonymous user (uid=0) if applicable. so if user creates/edits node through ui, , implement hook_node_update() , $user object of user responsible creating content, expect. drupal runs cro

javascript - adding a property to an object in js -

i have jstree populated code: jquery(function($) { var treeslist = {!trees}; for(j=0; j<treeslist.length; j++) { console.log(treeslist[j]); $("#jstree"+treeslist[j].attr.promotion_item).jstree({ // here define tree structure "core" : { "animation" : 200 }, "json_data" : { "data" : treeslist[j]}, "themes" : {"dots" : false, "theme" : "classic"}, "types" : { "types" : { "default" : { "icon" : { "image" : null } }, } }, "plugins" : [ "themes", "json_data" , "types"] }); } rerendertable(); }); i want set href attribute json_data if print treeslist element, data has title not href attribute. how can add js in ord

android - I can not edit the listview need onContextItemSelected -

@override public boolean oncontextitemselected(menuitem item) { // adaptercontextmenuinfo info= // (adaptercontextmenuinfo)item.getmenuinfo(); // todo auto-generated method stub adaptercontextmenuinfo info = (adaptercontextmenuinfo) item .getmenuinfo(); switch (item.getitemid()) { case r.id.menu_delete: this.results.remove(info.position); arrayadapter<string> madapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_1, results); setlistadapter(madapter); madapter.notifydatasetchanged(); return true; case r.id.menu_editar: this.results.add(info.position, null); arrayadapter<string> madapter1 = new arrayadapter<string>(this, android.r.layout.simple_list_item_1, results); setlistadapter(madapter1); madapter1.notifydatas

asp.net - Threads in c# to be executed at 1 minute intervals of server time -

i have created thread in c# application. code given below. [webmethod] public void start() { thread thread = new thread(new threadstart(workthreadfunction)); thread.start(); } [webmethod] public void stop() { thread thread = new thread(new threadstart(workthreadfunction)); thread.abort(); } public void workthreadfunction() { try { timezone zone = timezone.currenttimezone; datetime dt = datetime.now.addhours(12); dt = dt.addminutes(30); timespan offset = zone.getutcoffset(datetime.now); string s = "insert tb_log(timestamp) values('" + dt + "')"; class1 obj = new class1(); string res = obj.executequery(s); } catch { } } when run code value enters @ 1 time table. need execute thread @ 1 min intervals throughout day, week , year. how make possible? correct me if code had written correct or not. i'm new threads in c#. please

ajax - Remember me login function and user session php -

i tried implement remember me function in login page. have ajax login page , part of code check users after clicking login button. problem php's default lifetime session until browser closed. can change session lifetime think it's not point. also have added remember me check box @ login page. it's simple html. code: session_start(); include('db.php'); $_post = mysql_real_escape_array($_post); if($_post['ahd_username'] && $_post['ahd_password']) { $pass = md5($_post['ahd_password']); $result = mysql_query('select * members username="'.$_post['ahd_username'].'" , password="'.$pass.'" , validate="0"'); if(mysql_num_rows($result) > 0) { $_session['username'] = $_post['ahd_username']; $_session['password'] = md5($_post['ahd_password']); $row = mysql_fetch_array($result); $_session

c# - HyperLink text not rendered after controls are added -

i have hyperlink control text in text property. with following code: var link = new hyperlink(); var img = new htmlgenericcontrol("img"); img.attributes.add("src", "text.png"); link.text = "test"; link.controls.add(img); when this, image rendered inside a tag, text not rendred. there way render both image , text inside text property without throwing third control in mix? when put controls webcontrol.controls collection, ignore have inside text . if want render both text , other child controls, should add text controls : var link = new hyperlink(); var img = new htmlgenericcontrol("img"); img.attributes.add("src", "text.png"); link.controls.add(new literal{ text = "test"}); // line add text link.controls.add(img);

java - Decimal conversion - NumberFormatException -

i have string number = 1.0e7; i want numeric equivalent i.e display double x = 10000000.0000 how can go it? i have tried double number = double.valueof(number); but getting java.lang.numberformatexception . to format number 4 decimals, use string.format("%.4f", num) in following example: public class k { public static void main(string argv[]) { string number = "1.0e7"; double num = double.valueof(number); system.out.println("double="+ num + " formatted double=" + string.format("%.4f", num)); } } output: string=1.0e7 formatted double=10000000,0000 as can see, locale uses , decimal separator.

swing - Java Applet JFileChooser button issue? -

if ("analyze text file".equals(command)) { jfilechooser chooser = new jfilechooser(); chooser.setmultiselectionenabled(true); if (chooser.showopendialog(null) == jfilechooser.approve_option) { file[] files = chooser.getselectedfiles(); (file file : files) { try { bufferedreader reader = new bufferedreader(new filereader(file)); sb.append(line); } string text = sb.tostring(); map<integer, integer> counts = getcounts(text) histogrampanel panel = new histogrampanel(width, counts, height, horizon } catch (exception ex) { ex.printstacktrace(); } } } i trying jfilechooser pop once click "analyze text" button, allow user select text file processed code , output bar chart. working except button reason. if can appreciated. // object textfile = null; else if(

python tkinter button set variable to false -

i don't know set variable pressing button in python. example: done = false ... range_button = button(self.parent, text="start", command=lambda.... ... while done: ..... but don't know how in python, help? there's nothing special doing tkinter -- if done global variable (or instance variable) set whatever value want. important part is, must non-local variable. range_button = button(..., command=stop_loop) def stop_root(): global done done = true def something_else(): global done while !done: ... strictly speaking, don't need global done statement in function loop, since function isn't changing value of variable. however, think makes intent of code little more evident.

c# - I want to convert all my classes in Generic classes then call classes methods -

i want use generics able use proxy kind of realclient . public interface iclient { string getdata(); } public class realclient : iclient { string data; public realclient() { console.writeline("real client: initialized"); data = "success"; } public string getdata() { return data; } } public class proxy : iclient { realclient _classobject = new realclient(); public proxy() { console.writeline("proxyclient: initialized"); } public string getdata() { return _classobject.getdata(); } } class program { static void main(string[] args) { proxy proxy = new proxy(); console.writeline("data proxy client = {0}", proxy.getdata()); console.readkey(); } } it seems you're trying implement proxy design pattern , , want proxy work kind of iclient . if so, don't need generics this. you'd implem

playframework 2.0 - slick2 + play2 returns a collection of objects json format error -

slick code: case class user(id: option[int], name: option[string]) class usertable(tag: tag) extends table[user](tag, "app_user") { def id = column[int]("id", o.primarykey, o.autoinc) def name = column[string]("name", o.nullable, o.dbtype("varchar(8)")) override def * = (id.?, name.?) <> (user.tupled, user.unapply _) } object userhelper { val quser = tablequery[usertable] def all: list[user] = db withsession { implicit session => quser.list.map(u => user.tupled(u.id, u.name)) } } play code: object usercontroller extends controller { def index = action { ok(json.tojson(userhelper.all)) } } compilation error: no json deserializer found type list[user]. try implement implicit writes or format type.