Posts

Showing posts from April, 2013

java - How can I draw an image part by part? -

Image
class drawima extends jpanel{ protected void paintcomponent(graphics g) { super.paintcomponent(g); (int i=0;i<20;i++){ (int j=0;j<20;j++) { g.drawimage(buarr[i*20+j], 20*i, 20*j, 20, 20, null); try { thread.sleep(10); } catch (interruptedexception e) { e.printstacktrace(); } } } } } in part, buarr 400 blocks divided bufferedimage , want them draw 1 one, method can not draw blocks separately, how can this? swing single thread , not thread safe. this means should not perform long running or blocking ( thread.sleep ) operations within iu thread (the event dispatching thread). means can not update, modify or create ui elements outside of edt context. instead, use swing timer generate repeated callback @ specified interval , render portions of image bufferedimage , can paint component via paintcompon...

ios - Is it possible to delete data from all tables within Sqlite Database simultaneously -

actually, need delete , insert data in tables when going launch app. so, please tell me best solution yes @dai explanation correct. if going delete table rows 1 one each table memory consuming too. it takes bit of time remove table's rows. need query separately each table , need check constraint not conflict other table . suppose, table reference table b must have remove table b records before going remove table records. there many things needs check before going removing each tables records. as @dai said if dropping table no issue current implementation. i suggest 1 step ahead of this. why don't remove database copy bundle. as per knowledge creating database , place in application bundle. if previous state of database not required remove database , copy new application bundle. this fast perform on application launch.

ios - Presenting view controllers on detached view controllers is discouraged -

i trying move new view controller current view controller using following code this self.loginview = [self.storyboard instantiateviewcontrollerwithidentifier:@"login"]; [self presentviewcontroller:self.loginview animated:no completion:nil]; this code works fine ios 8 in ios 7(iphone) not working. can me rid of error? please try use [self.view.window.rootviewcontroller presentviewcontroller:self.loginview animated:no completion:nil];

android - MultipartEntity post array -

i'm trying upload file using http post request. figured doable using multipartentity, such: multipartentity entity = new multipartentity(); ... entity.addpart("caption", new stringbody("mycaption")); entity.addpart("file", new filebody(file)); entity.addpart("uploadername", new stringbody("myname")); ... my problem structure post request needs made. instead of rather straightforward... { "caption":[caption], "file":[file upload], "uploadername":[name] } ..it is.. { "newfile": { "caption":[caption], "file":[file upload] }, "uploadername":[name] } if don't need post files, can use jsonobject , put 1 jsonobject inside other, can't figure out way multipartentity. clues? in advance. ..okay, guess found way it. .... entity.addpart("newfile[caption]", new stringbody("mycaption...

java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64String -

i trying encrypt plain text using org.apache.commons.codec.binary.base64. when call method org.apache.commons.codec.binary.base64.encodebase64string(abytearray) , gives following exception exception in thread "main" java.lang.nosuchmethoderror: org.apache.commons.codec.binary.base64.encodebase64string([b)ljava/lang/string; i using jar, org-apache-commons-codec.jar. please me can't understand wrong this. first of encoding not encryption . changing representation of string while encoding, changed back . since getting exception means @ least have jar in classpath. open jar suitable zip tool 7-zip , @ manifest.mf file. jar version should greater 1.4 according base64javadoc . download latest version , replace older version.

thumbnail returns null on android above version 4.0 -

i getting same this issue public class mainactivity extends activity { imageview imgvie; bitmap bmp,extbmp; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); imgvie = (imageview)findviewbyid(r.id.imageview1); string path = "http://202.65.154.108:8080/vodstream/lokesh.stream.mp4"; bmp = thumbnailutils.createvideothumbnail(path, thumbnails.full_screen_kind); if(bmp!=null) { extbmp = thumbnailutils.extractthumbnail(bmp, 300, 300); imgvie.setimagebitmap(extbmp); } if(bmp==null) { toast.maketext(getapplicationcontext(), "sorry bitmap returns null", toast.length_long).show(); } } } when run application in nexus4s entering if condition.in other phones moving else. have suggestions. 1)- sometim...

cordova - Phonegap PDF Viewer or Open pdf file from local for Windows Phone 8 -

i working in phonegap windows phone 8 app. stuck opening pdf file local area (like in phone >> documents >> myfolder>>1.pdf) i tried in js document.addeventlistener("deviceready", deviceready, false); function deviceready() { window.open('.documents/myfolder/1.pdf', '_blank', 'location=no'); } but doesn't work. i tried window.open('**documents**/myfolder/1.pdf', '_blank', 'location=no'); and window.open('**/documents**/myfolder/1.pdf', '_blank', 'location=no'); but neither works. otherwise, if there pdf viewer plugin phonegap , wp8, please share link. note: have adobe pdf reader installed on phone try of following works you. window.open('http://www.example.com/test.pdf', '_system', 'location=yes'); window.open('http://www.example.com/test.pdf', '_blank', 'location=no,closebuttoncaption=close,enablevi...

java - Why does calling this method on the EDT cause a compilation error? -

i trying pop custom dialog box. when try calling method on edt following error: exception in thread "awt-eventqueue-0" java.lang.error: unresolved compilation problem: @ danind.com.gmail_coem.ui.credentialeditor.promptpossibledialog(credentialeditor.java:29) @ danind.com.gmail_coem.ui.homescreen$configuredatabase.<init>(homescreen.java:281) @ danind.com.gmail_coem.ui.homescreen.configuredatabase(homescreen.java:230) @ danind.com.gmail_coem.ui.homescreen.lambda$1(homescreen.java:105) @ danind.com.gmail_coem.ui.homescreen$$lambda$7/2092062410.actionperformed(unknown source) @ javax.swing.abstractbutton.fireactionperformed(unknown source) @ javax.swing.abstractbutton$handler.actionperformed(unknown source) @ javax.swing.defaultbuttonmodel.fireactionperformed(unknown source) @ javax.swing.defaultbuttonmodel.setpressed(unknown source) @ javax.swing.plaf.basic.basicbuttonlistener.mousereleased(unknown source) @ java.awt.awteventmulticaster.mousereleased(unknown source...

hadoop - DBInputWritable throwing Exception -

import java.io.*; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception; import org.apache.hadoop.io.writable; import org.apache.hadoop.mapreduce.lib.db.dbwritable; public class dbinputwritable implements writable, dbwritable { string symbol; string date; double open; double high; double low; double close; int volume; double adjclose; //private final static simpledateformat sdf = new simpledateformat("yyyy-mm-dd"); public void readfields(datainput in) throws ioexception { symbol=in.readline(); date=in.readline(); open=in.readdouble(); high=in.readdouble(); low=in.readdouble(); close=in.readdouble(); volume=in.readint(); adjclose=in.readdouble(); } public void readfields(resultset rs) throws sqlexception { symbo...

objective c - iOS:mobile sim verification code from app -

i doing ios app having concept of sending verification code mobile no same mobile verified , give sms me. need unique id process.same kind of process using whats app , other chatting apps. 1)my problem able send message same mobile no , receiving message need unique identification number particular mobile. if place sim card in other mobile unique identification in may not collide . as apple has stopped accessing device udid's programmatically. can use vendor id unique identifier. vendor id different same app on different device.

php - Print Automatic PDF from folder -

i wanted print pdf generate fpdf in php automatically server's folder. is there way automatically print pdf printer connected server specified folder? or print pdf generated in device accessing server, server's default printer. we this, albeit in hacky way. here steps: generate pdf fpdf , save location on disk on page has loaded (or page) have iframe. javascript set frame's location of pdf again use javascript print iframe. note: our method has confirm print dialogue button before prints. possibly can set printer settings. if want print without hassle, there ways directly connect printer php, 1 know of via pecl extension, , think that's windows only.

php - .htaccess http to https redirect loop issue -

i trying redirect users https://example.com when enter http://example.com in browser. using .htaceess acheive redirection. problem after adding below .htaccess site, browser(chrome) shows this webpage has redirect loop . .htaccess file <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{https} off rewriterule ^(.*)$ https://%{http_host}%{request_uri} [l,r=301] rewritecond %{http_host} !^www\. rewriterule ^(.*)$ https://www.%{http_host}%{request_uri} [l,r=301] </ifmodule> please suggest me solution user below code : rewriteengine on rewritecond %{https} off rewriterule (.*) https://%{http_host}%{request_uri}

c# - MySQL Connector .NET EF6 operator LIKE not working -

i using mysql connector .net entityframework 6, version 6.9.5.0. i build query "like" : var q = u in ctx.db.users u.name.startswith(query) select u; it compiled : select ... `user` `extent1` `extent1`.`name` 'p__linq__0%' so query fails, because users' name never this... (maybe 1 day ?) is bug, expected behavior or have missed ? thanks. found 2 tickets in mysql bugtracker : http://bugs.mysql.com/bug.php?id=74904 http://bugs.mysql.com/bug.php?id=74943

ios - cognito - Access to Identity is forbidden -

i trying understand amazon cognito , trying list contents of s3 folder after login through facebook. face book login works fine. when tap test button (cmdtests3tapped) throws following error. i included amazonclientmanager.h,amazonclientmanager.m , constants.h project examples amazon provided. constants given belllow. can me resolve issue. #define awsaccountid @"myaccountid" #define cognitopoolid @"us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx" #define cognitoroleauth @"arn:aws:iam::myaccountid:role/cognito_iostestpoolauth_defaultrole" #define cognitoroleunauth @"arn:aws:iam::myaccountid:role/cognito_iostestpoolauth_defaultrole" this role - cognito_iostestpoolauth_defaultrole { "version": "2012-10-17", "statement": [{ "action": [ "mobileanalytics:putevents", "cognito-sync:*" ], "effect": "allow", ...

c++ - Compilation error Friend class unable to access field -

i trying compile qt5.3 files in question qv4executableallocator_p.h , qv4executableallocator.cpp. relevant code snippet header below struct allocation{ allocation() : addr(0) , size(0) , free(true) , next(0) , prev(0) {} void *start() const; void invalidate() { addr = 0; } bool isvalid() const { return addr != 0; } void deallocate(executableallocator *allocator); private: ~allocation() {} friend class executableallocator; allocation *split(size_t dividingsize); bool mergenext(executableallocator *allocator); bool mergeprevious(executableallocator *allocator); quintptr addr; uint size : 31; // more 2gb of function code? nah :) uint free : 1; allocation *next; allocation *prev; }; in cpp function executableallocator::chunkofpages::~chunkofpages() compilation error when trying access alloc->next. qv4::executableallocator::allocation* qv4::exec...

SQL statements of package not available in db2 catalog table -

i want check sql statements of db2 packages. there no statements available in db2 catalog tables. i used query : select stmt sysibm.syspackstmt name =<package-name> but there no statements in stmt column . can please suggest else can check sql statements of package? fyi, using db2 z/os v10 . going migrate v11 before want make sure packages referincing sysstr system tablespace modified part of pre-migration v11 . thanks in advance. maybe can there. on db2 z/os v10 , found table called sysibm.syspackstmt in table there column called stmt empty column called statement , contains sql statements. have table select stmnt_id, statement sysibm.syspackstmt name = <package name> edit: ok there no column statement in table syspackstmt: here columns table has on our z/os db2 v10. can't exclude table different doubt system table of db2 location collid name contoken seqno stmtno sectno binderror ibmreqd version stmt isolation status ...

ios - Remove viewcontroller & move to next view controller -

hi have been working on ios app.what doing navigating among diffrent view controllers. problem want finish current view controller emoery , move next view controller. i using `[self.view removefromsuperview]; finishing cureent view & using self.loginview = [self.storyboard instantiateviewcontrollerwithidentifier:@"login"]; [self presentviewcontroller:self.loginview animated:no completion:nil]; for moving next view controller thing not able remove memory. please tell me how can it? thanks in advance. ` it's better create container view controller manages view controllers. example, in viewdidload: of container controller add current controller: [self addchildviewcontroller:self.currentviewcontroller]; [self.currentviewcontroller didmovetoparentviewcontroller:self]; [self.view addsubview:self.currentviewcontroller.view]; //here set currentviewcontroller view's frame or constraints if needed when need open login controller, this: [s...

c# - Passing a javascript array to controller create action -

there 1 issue cannot find ideal solution i'm asking here. how can pass array created in jquery view controller action create. i have class model person public class person { public int personid {get; set;} public string name {get; set;} public int age {get; set;} public virtual icollection <friend> friends {get; set;} } the controller action create: [httppost] [validateantiforgerytoken] public actionresult create([bind(include = "name,age")]person person) { if (modelstate.isvalid) { db.person.add(person); db.savechanges(); return view(configuration); } the scenario create new person , add person list of friends. @ point figured create array of friends in jquery have no idea how post create action. view of create: @using life.models @model life.models.person @{ viewbag.title = "create person"; } <script src="~/scripts/jquery-2.1.1.min.js"></script> <script>...

uvm - Where does get_and_drive come from? -

since found every driver extends uvm_driver have task: get_and_drive below. checked uvm source code , uvm_cookbook, didn't find get_and_drive. seems not uvm rule, more convention. question is: first use task named get_and_drive() , why people use name get_and_drive in driver? task run_phase(uvm_phase phase); get_and_drive(); endtask : run_phase task get_and_drive(); forever begin seq_item_port.get_next_item(req); send_to_dut(req); seq_item_port.item_done(); end endtask : get_and_drive if in example/integrated/ubus directory, in ubus_master_driver you'll see method that's called get_and_drive() . if go ovm, you'll see in xbus example defined same method in xbus_master_driver . since people learn example, guess convention stuck. think other methodology sites (like verification academy ) promote same convention.

java - How to mark Spring MVC params as required -

i have such method in spring controller @requestmapping(value = "/updatearticle", method = requestmethod.post) @responsebody public void updatearticle(long id, string name, string description) { ... } i want id, , name required. in other words, if null values, exception must thrown. how can that? there annotation or that? thanks yes, there is. @requestparam(required=true) see docs . required flag true default, need is: @requestmapping(value = "/updatearticle", method = requestmethod.post) @responsebody public void updatearticle(@requestparam long id, @requestparam string name, @requestparam string description) { ... }

c# - remove recipient from mail.recipient collection -

i have application sends e-mail via outlook. code receives mail recipient list program. issue need remove 1 of e-mail addresses before sending e-mail. this receive, recipients populated. outlook.mailitem mail = _otapp.createitem(outlook.olitemtype.olmailitem); i know can add new recipients using line below, mail.recipients.add("joe.blogs@someaddress.com"); i know there mail.recipients.remove method. method though requires me know position of e-mail address need remove not know. you can use recipient.delete. following (off top of head): foreach (var recipient in mail.recipients) { if (string.compare(recipient.address, "joe.blogs@someaddress.com", true) == 0) { recipient.delete(); break; } }

ios - Crash in ios7 while setting font on navigation bar -

i using link here change font , color of title in navigation bar. tried this . both of them run fine in ios8 when test in ios7 each time crashes @ "nsfontattributename". if remove code set font , set color , works. the crash message * terminating app due uncaught exception 'nsinvalidargumentexception', reason: '*** -[__nsplaceholderdictionary initwithobjects:forkeys:count:]: attempt insert nil object objects[1] any appreciated. hope problem clear. use code: uinavigationbar *navbar = [uinavigationbar appearance]; [navbar settitletextattributes:@{nsfontattributename: [uifont fontwithname:@"yourfont" size:15]];

take span class value in jquery -

i failed value of span class click in jquery. put value of 2 differnt sapn value in if condition. if(span value == this){}else {} need span value in jquery function. code : <div class="two toggle_height"> <h6 style="padding: 0 171px;">is active</h6> <div class="button-wrap button-active"> <div class="button-bg"> <div class="button-out"><span class="out">off</span></div> <div class="button-in"><span>on</span></div> <div class="button-switch"></div> </div> </div> </div> jquery: $('.button-wrap').on("click", function(){ $(this).toggleclass('button-active'); }); $('.button-wrap').on("click", function(){ $(this).toggleclass('button-active'); }); .two .button...

ruby - Simple Rails Association causing ArgumentError -

edit: this not dupe of can't migrate after scaffold in hartl's tutorial ! have arel updated in gemfile in case, makes no difference. also, post-migration, rake finished fine. after rake, when try query association via console, that when error! i have 2 models simple one-to-many association between them. after adding second model , raking db, opened rails console test stuff out, , error every time try use association in query. here classes: class startup < activerecord::base has_many :reqs end class req < activerecord::base belongs_to :startup end this migration reqs table: class createreqs < activerecord::migration def change create_table :reqs |t| t.string :title t.text :desc t.integer :sort t.references :startup, index: true t.timestamps null: false end end end and here simple test i'm trying test in console afterwards: > startup = startup.first > startup.reqs ## generates ar...

FindBugs Eclipse plugin: is there a way to set "Run automatically," and "(also on full build)" options on workspace level? -

i have eclipse (kepler) workspace several (mostly java) projects. installed findbugs (2.0.3) plugin, , noticed "run automatically," , "(also on full build)" options configurable on project level - , not on workspace level. is there convenient way enable/disable these options on workspace level (other search/replace approach on .project files)? update : seems feature considered added upcoming 3.0.1 version: https://sourceforge.net/p/findbugs/feature-requests/287/ this may mean there's no way in 2.0.3 plugin, means solution problem write search&replace script :-( short version: since question received no answers in year, safe assume, answer is: no , eclipse find bugs plugin 2.0.3 (or earlier) not capable of workspace-level configuration of mentioned options. possible workarounds: upgrade 3.x.x or higher versions of plugin. (i mentioned in question above.) if upgrading not option, have bulk update .project files. i'm pretty sure...

ember.js - Ember JS to bind helpers inside specific div -

here facing problem bind ember.textfield <div id="bindhere"></div> through indexcontroller without using template format. because appearing @ end of code. here template <script type="text/x-handlebars" id="index" > < button {{action "select" on="click"}}>ok </button> {{outlet}} </script> **here controller** app = ember.application.create(); app.indexcontroller = ember.objectcontroller.extend({ actions: { select: function(param1, param2) { ember.textfield.create({ classnames: ['btn btn-sm btn-danger glyphicon glyphicon-pencil'], type: 'button', attributebindings: ['value'], value: "new button", action: '{{formeditchangefinder}}' , onevent: 'click', //attributebindings...

c# - How to connect with linux server using SSH connection? -

Image
i new ssh connection & trying connect using ssh connection getting exception: inheritance security rules violated while overriding member: 'renci.sshnet.common.sshexception.getobjectdata(system.runtime.serialization.serializationinfo, system.runtime.serialization.streamingcontext)' security accessibility of overriding method must match security accessibility of method being overriden. please me resolve issue mark getobjectdata securitycriticalattribute , because it's applied exception.getobjectdata . overridden member should have same security accessibility (critical, safe critical or transparent). more info

How do I subscribe someone to a list using the python mailchimp API v2.0? -

i want subscribe user list using mailchimp api 2.0 , official mailchimp python package . can't find direct documentation how. before start, you'll need api key , list id logging mailchimp. to api key, visit accounts > extras , generate api key. list id, visit lists > list > settings > list name , defaults . next, make sure you've installed mailchimp python package: pip install mailchimp finally: import mailchimp api_key = 'my-api-key' list_id = 'my-list-id' api = mailchimp.mailchimp(api_key) api.lists.subscribe(list_id, {'email': 'email@example.com'})

matlab - Surface on 3d points -

i have lot of points on 3d space, such as: [177,867390625000, -173,140625000000, -149,666937500000], [202,519976190476, -163,001285714286, -77,1924761904762], [175,576234375000, -148,980296875000, -135,779421875000], [244,798280000000, -210,332080000000, -177,070066666667], [240,668416666667, -156,703083333333, -135,545016666667] and create surface plots these points. the format of data not clear. if each line coordinate, is x = [177, 173, ...] y = [-77, ...] then, can plot them plot(x, y, z, '.b') where dot means "plot them individual points, without connecting them lines". first, remove commas in numbers (replace them dots if decimal points)

asp.net - Got Error at RunTime because of Required Field Validator -

i developing asp.net application in visual studio 2013, while adding required field validator , getting error @ runtime .. , error below ... please me crack problem source error: an unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below. stack trace: { [invalidoperationexception: webforms unobtrusivevalidationmode requires scriptresourcemapping 'jquery'. please add scriptresourcemapping named jquery(case-sensitive).] system.web.ui.clientscriptmanager.ensurejqueryregistered() +2179162 system.web.ui.webcontrols.basevalidator.registerunobtrusivescript() +10 system.web.ui.webcontrols.basevalidator.onprerender(eventargs e) +9708897 system.web.ui.control.prerenderrecursiveinternal() +83 system.web.ui.control.prerenderrecursiveinternal() +155 system.web.ui.control.prerenderrecursiveinternal() +155 system.web.ui.page.processrequestmain(b...

java - ssh with jsch: non 'simple' command output trailed with unexpected output combined from fragments of the command in use -

i'm running several commands on ssh using jcraft.jsch channel , see whenever use complicated command (with regexp or using pipes) output of command has unexpected 'prefix' combined fragments of command or entire command fragmented small pieces separated multiple spaces , combined '<' characters here , there... example 1: #ls /opt/qb/data2/oscar/process-manager-helper/*/var/core-dump/{2089,2090,2091,2092,2093,2094,2095}.* ger-helper/*/var/core-dump/{20 <2/oscar/process-manager-helper/*/var/core-dump/{208 9,2090,2091,2092,ls: cannot access /opt/qb/data2/oscar/process-manager-helper/*/var/core-dump/2090.*: no such file or directory ls: cannot access /opt/qb/data2/oscar/process-manager-helper/*/var/core-dump/2092.*: no such file or directory ls: cannot access /opt/qb/data2/oscar/process-manager-helper/*/var/core-dump/2094.*: no such file or directory ls: cannot access /opt/data2/oscar/process-manager-helper/*/var/core-dump/2095.*...

How to force Azure Websites guest OS version update/choose -

azure websites running on vms, managed ms. guest os version chosen ms. but os updates critical me (for example timezone updates, in this question ). according azure guest os releases (and rss feed ) new os versions released. these os patch included in guest os versions released @ 5 (and later) - cloud services have correct timezone data. but "test" website (from prev. question ) shows guest os still have no timezone patch. think website still running on vm old guestos. is there way view guestos version website running on (from code)? know hot view guestos version cloud services, not website. why vms runs websites still not updated? how updated? can someway force website run/migrate 'fresh' guest os? think 'no', maybe...

ANTLR3 : MissingTokenException when using already defined token in input in place of ID -

i stumbled upon problem while writing grammar rules create table. grammar failing when column names defined tokens in grammar (can't have column name 'create' matched 'create' keyword! simple usecase : grammar hello; start : 'hello' 'world' id ; id : 'a'..'z'+ ; ws : (' '|'\n'|'\r')+ {$channel=hidden;} ; for grammar how make "hello world hello" valid input. failing missingtokenexception . ast root | start __________________________________ | | | hello world missingtokenexception thanks in advance. edit: i have found inline-rule while definition rule "hello" & "world", still find how works. grammar hello; stat: keyhello keyworld expr ; expr: id ; /** id text "hello" */ keyhello : {input.lt(1).gettext().equa...

pdf - How get symbols of glyphs in CFF font -

i parsing cff file. table glyphs, whick looks gc4g38gfcgd7g70g4bgeag39gfdg4cgebgfeg72g4dgec... names. have offsets each glyph , have offsets charstringindex. have associate glyphs manes symbols. have do? offsets don't explain symbol. it depends on kind of encoding cff relies on: follow of predefined charset/encodings, or free charset/encoding cff block? (which type is recorded in top dict structure) if first, glyph names defined adobe's charset/encoding specifications , not stored in font itself. if you're writing parser, you'll need code predefined encodings associated glyph names. if font follows 1 of these, must contain every character in set, in predefined glyph ordering (so cff following encoding x have glyph named 23rd name string in glyph position 23). if second, names each glyph stored in string block, every other string in cff (but offset 390, because there many documentation-specified strings apply cff , not need stored explicitly in cff data)...

mysql - why two sql giving different result? -

i confused here first sql- i have 1 entry in cnt_content table content_pk=5419441 , title=test wls-2 now when running sql 1- select title, content_pk cnt_content c c.type not in ( 'amt', 'lpa', 'que' ) , c.private_flag = 'n' , c.searchable_flag = 'y' , c.status in ( 'pub', 'nap' ) , ( trim(c.title) 'test wls-2' or trim(c.special_keyword) 'test wls-2' ) , not exists ( select 1 cmd_content_metadata cmd cmd.content_pk=5419441 , cmd.for_others='y' ) order c.last_modified_date desc; it giving result- content_pk=5419441 , title=test wls-2 but when running sql 2- select title, content_pk cnt_content c c.type not in ( 'amt', 'lpa', 'que' ) , c.private_flag = 'n' , c.searchable_flag = 'y' , ...

go - How to pass variable length arguments as arguments on another function in Golang? -

how pass variable length arguments in go ? example, want call func myprint(format string, args ...interface{}) { fmt.printf("[my prefix] " + format, ???) } // called as: myprint("yay %d", 213) // or myprint("yay") // or myprint("yay %d %d",123,234) ah found it.. package main import "fmt" func myprint(format string, args ...interface{}) { fmt.printf("[my prefix] " + format, args...) } func main() { myprint("yay %d %d\n",123,234); myprint("yay %d\n ",123); myprint("yay %d\n"); }

java - How to sort Alphanumeric String -

i have problem sorting strings include integers. if use below code sorting like: 1some, 2some, 20some, 21some, 3some, some however want sorted like: 1some, 2some, 3some, 20some, 21some, some how can this? thanks! collections.sort(selectednodes, new comparator<defaultmutabletreenode>() { @override public int compare(defaultmutabletreenode o1, defaultmutabletreenode o2) { return o1.getuserobject().tostring() .compareto(o2.getuserobject().tostring()); } }); here self-contained example on how (not particularly optimized): final pattern p = pattern.compile("^\\d+"); string[] examples = { "1some", "2some", "20some", "21some", "3some", "some", "1abc", "abc" }; comparator<string> c = new comparator<string>() { @override public int compare(string object1, string object2) { matcher m = p.matcher(obje...

mysql - PHP, reload the page and display Invalid credentials message? -

i have snippet in index.php file, ask user log on. if details aren't in database system, want reload index.php page , show message "invalid credentials, try again" or that. how can achieve this? here code: <?php session_start(); //check if user logged in if(!isset($_post['id'])) { $message = 'user logged in already'; } //check username , password have been submitted if(!isset( $_post['username'], $_post['password'])) { $message = 'please enter valid username , password'; } //check username correct length else if (strlen($_post['username']) > 20 || strlen($_post['username']) < 4) { $message = 'incorrect username length, please try again'; } //check password correct length else if (strlen($_post['password']) > 20 || strlen($_post['password']) < 4) { $message = 'incorrect password length, please try again'; } //check username has alpha numer...

json - Non-english characters in python dictionary not printed correctly -

ok, first,yes have read http://www.joelonsoftware.com/articles/unicode.html still have problems understanding why: # -*- coding: utf-8 -*- import json a='ööö' b='ääß' print a+' '+b >>>ööö ääß print {'a':a,'b':b} >>>{'a': '\xc3\xb6\xc3\xb6\xc3\xb6', 'b': '\xc3\xa4\xc3\xa4\xc3\x9f'} can assist in how have output print {'a':a,'b':b} >>>{'a': 'ööö', 'b': 'ääß'} i tried every combination of unicode(a), a.encode('utf-8'), unicode(a).encode('utf-8') , likes, no avail. feeling stupid. would appreciate if explain foor noobs, full examples.l thanks lot! >>> d = {'a': unicode('ööö', 'utf-8'), 'b': unicode('ääß', 'utf-8')} >>> print repr(d).decode("unicode-escape") {'a': u'ööö', 'b': u'ääß'} ...

html - Giant invisible div covers whole webpage -

me , few classmates working on project have make webshop. working github has latest version. using google chrome, i. on classmate's browsers webshop works fine. , on mine there giant invisible div covers whole page can't click on anything. this div i'm taking about: <div style="position: absolute; z-index: -1; top: 0px; left: 0px; right: 0px; height: 1001px;"></div> if use "inspect element" div shown @ bottom of html code. (just above tag. takes container use. , on browsers of classmates whole div doesn't excist! so question is: there knows how fix this? edit: in ie works fine me too. google chrome creates weird div. it's because of extension named "smooth scroll" on google chrome, try disabled or remove it

c# - Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type -

i working .net4.5 , vs2013, have query gets dynamic result db. dynamic topagents = this._datacontext.sql( "select t.create_user_id \"user\", sum(t.netamount) \"amount\" transactiondetail t t.update_date > sysdate -7 group t.create_user_id") .querymany<dynamic>(); following statement fails compilation error cannot use lambda expression argument dynamically dispatched operation without first casting delegate or expression tree type without allowing me run it topagents.tolist().select(agent => new { user = agent.user != null ? string.format("{0}", agent.user).replace("corpntgb\\", "") : null, amount = agent.amount }); while 1 foreach works fine. var data = new list<list<object>>(); foreach (dynamic agent in topagents) { data.add(new list<object> { agent.user != null ? string.format("{0}", agent.user).replace("corpntgb\\", "...

validation - Django: fetching data from form fields that takes multiple values -

currently,i building django powered web app displaying filtered data form master table.i have created form user specify his/her choice , depending upon form values data( in tabular form) displayed. problem not able fetch data form fields takes multiple values.i using "request.post.get('fieldname','') fetch data form, multiple values fields , it's displaying last value. example : if user selecting first, second , fourth option in formfield "modules", request.post.get('modules','') is giving me fourth option. hope making myself clear. views.py def consisreportgen(request): if request.method == 'post': form = consistencyform(request.post or none) if form.is_valid(): form_user_data = consistencyform(request.post) customer=form.cleaned_data['customer'] components=form.cleaned_data['components'] modules=form.cleaned_data['modules'] customernam...