Search Results

Search found 3892 results on 156 pages for 'boolean'.

Page 6/156 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in

    - by alundra00
    hi i am new to php and now i having problem with login Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in... Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in.... coding php: <?php include ("config/koneksi.php"); include ("config/library.php"); $pass = md5($_POST['password']); $login = mysql_query("SELECT * FROM user WHERE id_user='$_POST[username]' AND sesi='$pass'"); $found = mysql_num_rows($login); //error $r = mysql_fetch_array($login); //error if ($r){ session_start(); session_register("username"); session_register("sesi"); session_register("role"); $_SESSION[username] = $r[id_user]; $_SESSION[sesi] = $r[sesi]; $_SESSION[role]= $r[role]; header ('location:home.php'); }

    Read the article

  • The "CreateRiaClientFilesTask" task failed unexpectedly.

    - by Mohammadreza
    Hi guys. I've VS 2010 and recently installed WCF RIA Services V1.0. For testing I have created a new Silverligh Business project but now every now and then when I rebuild the solution I receive the following error: Does anybody know why I get this? Thanks Error 1 The "CreateRiaClientFilesTask" task failed unexpectedly. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ServiceModel.DomainServices.Tools, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.ServiceModel.DomainServices.Tools, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName) at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) at System.Type.GetType(String typeName, Boolean throwOnError) at System.Web.Hosting.HostingEnvironment.CreateWellKnownObjectInstance(String assemblyQualifiedName, Boolean failIfExists) at System.Web.Hosting.HostingEnvironment.CreateWellKnownObjectInstance(String assemblyQualifiedName, Boolean failIfExists) at System.Web.Hosting.ApplicationManager.CreateObjectInternal(String appId, Type type, IApplicationHost appHost, Boolean failIfExists, HostingEnvironmentParameters hostingParameters) at System.Web.Hosting.ApplicationManager.CreateObjectInternal(String appId, Type type, IApplicationHost appHost, Boolean failIfExists) at System.Web.Compilation.ClientBuildManager.CreateObject(Type type, Boolean failIfExists) at Microsoft.ServiceModel.DomainServices.Tools.CreateRiaClientFilesTask.CreateSharedTypeService(ClientBuildManager clientBuildManager, IEnumerable`1 serverAssemblies, ILogger logger) at Microsoft.ServiceModel.DomainServices.Tools.CreateRiaClientFilesTask.GenerateClientProxies() at Microsoft.ServiceModel.DomainServices.Tools.CreateRiaClientFilesTask.ExecuteInternal() at Microsoft.ServiceModel.DomainServices.Tools.RiaClientFilesTask.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. BusinessApplication2

    Read the article

  • SElinux process killed while trying to set boolean

    - by Antonio
    I've got a strange problem. I can not allow apache to connect to database at my CentOC 6.4 box: [root@centos6 ~]# setsebool -P httpd_can_network_connect on Killed [root@centos6 ~]# sestatus -b | grep httpd_can_network_connect httpd_can_network_connect off httpd_can_network_connect_cobbler off httpd_can_network_connect_db off I watched log file, but there was no log messages: tail -f /var/log/audit/audit.log UPDATE: There are some information in /var/log/messages: Nov 9 19:07:16 vs302 kernel: setsebool invoked oom-killer: gfp_mask=0x280da, order=0, oom_adj=0, oom_score_adj=0 Nov 9 19:07:16 vs302 kernel: setsebool cpuset=/ mems_allowed=0 Nov 9 19:07:16 vs302 kernel: Pid: 1660, comm: setsebool Not tainted 2.6.32-358.23.2.el6.x86_64 #1 Nov 9 19:07:16 vs302 kernel: Call Trace: Nov 9 19:07:16 vs302 kernel: [<ffffffff810cb641>] ? cpuset_print_task_mems_allowed+0x91/0xb0 Nov 9 19:07:16 vs302 kernel: [<ffffffff8111ce40>] ? dump_header+0x90/0x1b0 Nov 9 19:07:16 vs302 kernel: [<ffffffff8111d2c2>] ? oom_kill_process+0x82/0x2a0 Nov 9 19:07:16 vs302 kernel: [<ffffffff8111d201>] ? select_bad_process+0xe1/0x120 Nov 9 19:07:16 vs302 kernel: [<ffffffff8111d700>] ? out_of_memory+0x220/0x3c0 Nov 9 19:07:16 vs302 kernel: [<ffffffff8112c3dc>] ? __alloc_pages_nodemask+0x8ac/0x8d0 Nov 9 19:07:16 vs302 kernel: [<ffffffff81160d6a>] ? alloc_pages_vma+0x9a/0x150 Nov 9 19:07:16 vs302 kernel: [<ffffffff81143f0b>] ? handle_pte_fault+0x76b/0xb50 Nov 9 19:07:16 vs302 kernel: [<ffffffff81228664>] ? task_has_capability+0xb4/0x110 Nov 9 19:07:16 vs302 kernel: [<ffffffff81004a49>] ? __raw_callee_save_xen_pmd_val+0x11/0x1e Nov 9 19:07:16 vs302 kernel: [<ffffffff8114452a>] ? handle_mm_fault+0x23a/0x310 Nov 9 19:07:16 vs302 kernel: [<ffffffff811485b6>] ? vma_adjust+0x556/0x5e0 Nov 9 19:07:16 vs302 kernel: [<ffffffff810474e9>] ? __do_page_fault+0x139/0x480 Nov 9 19:07:16 vs302 kernel: [<ffffffff81148b8a>] ? vma_merge+0x29a/0x3e0 Nov 9 19:07:16 vs302 kernel: [<ffffffff81149fdc>] ? do_brk+0x26c/0x350 Nov 9 19:07:16 vs302 kernel: [<ffffffff8100ba1d>] ? retint_restore_args+0x5/0x6 Nov 9 19:07:16 vs302 kernel: [<ffffffff81513bfe>] ? do_page_fault+0x3e/0xa0 Nov 9 19:07:16 vs302 kernel: [<ffffffff81510fb5>] ? page_fault+0x25/0x30 Nov 9 19:07:16 vs302 kernel: Mem-Info: Nov 9 19:07:16 vs302 kernel: Node 0 DMA per-cpu: Nov 9 19:07:16 vs302 kernel: CPU 0: hi: 0, btch: 1 usd: 0 Nov 9 19:07:16 vs302 kernel: Node 0 DMA32 per-cpu: Nov 9 19:07:16 vs302 kernel: CPU 0: hi: 186, btch: 31 usd: 30 Nov 9 19:07:16 vs302 kernel: active_anon:132249 inactive_anon:46 isolated_anon:0 Nov 9 19:07:16 vs302 kernel: active_file:56 inactive_file:59 isolated_file:0 Nov 9 19:07:16 vs302 kernel: unevictable:0 dirty:2 writeback:0 unstable:0 Nov 9 19:07:16 vs302 kernel: free:1369 slab_reclaimable:1774 slab_unreclaimable:11588 Nov 9 19:07:16 vs302 kernel: mapped:54 shmem:48 pagetables:1211 bounce:0 Nov 9 19:07:16 vs302 kernel: Node 0 DMA free:2440kB min:72kB low:88kB high:108kB active_anon:12156kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:14648kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:24kB slab_unreclaimable:8kB kernel_stack:0kB pagetables:16kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes Nov 9 19:07:16 vs302 kernel: lowmem_reserve[]: 0 590 590 590 Nov 9 19:07:16 vs302 kernel: Node 0 DMA32 free:3036kB min:3072kB low:3840kB high:4608kB active_anon:516840kB inactive_anon:184kB active_file:224kB inactive_file:236kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:604988kB mlocked:0kB dirty:8kB writeback:0kB mapped:216kB shmem:192kB slab_reclaimable:7072kB slab_unreclaimable:46344kB kernel_stack:880kB pagetables:4828kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:128 all_unreclaimable? no Nov 9 19:07:16 vs302 kernel: lowmem_reserve[]: 0 0 0 0 Nov 9 19:07:16 vs302 kernel: Node 0 DMA: 0*4kB 1*8kB 0*16kB 0*32kB 0*64kB 1*128kB 1*256kB 0*512kB 0*1024kB 1*2048kB 0*4096kB = 2440kB Nov 9 19:07:16 vs302 kernel: Node 0 DMA32: 129*4kB 67*8kB 30*16kB 19*32kB 6*64kB 2*128kB 1*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 3036kB Nov 9 19:07:16 vs302 kernel: 182 total pagecache pages Nov 9 19:07:16 vs302 kernel: 0 pages in swap cache Nov 9 19:07:16 vs302 kernel: Swap cache stats: add 0, delete 0, find 0/0 Nov 9 19:07:16 vs302 kernel: Free swap = 0kB Nov 9 19:07:16 vs302 kernel: Total swap = 0kB Nov 9 19:07:16 vs302 kernel: 157439 pages RAM Nov 9 19:07:16 vs302 kernel: 6271 pages reserved Nov 9 19:07:16 vs302 kernel: 2686 pages shared Nov 9 19:07:16 vs302 kernel: 146395 pages non-shared Nov 9 19:07:16 vs302 kernel: [ pid ] uid tgid total_vm rss cpu oom_adj oom_score_adj name Nov 9 19:07:16 vs302 kernel: [ 271] 0 271 2798 231 0 -17 -1000 udevd Nov 9 19:07:16 vs302 kernel: [ 476] 0 476 2797 230 0 -17 -1000 udevd Nov 9 19:07:16 vs302 kernel: [ 718] 0 718 2279 122 0 0 0 dhclient Nov 9 19:07:16 vs302 kernel: [ 762] 0 762 6909 58 0 -17 -1000 auditd Nov 9 19:07:16 vs302 kernel: [ 787] 0 787 62270 147 0 0 0 rsyslogd Nov 9 19:07:16 vs302 kernel: [ 801] 25 801 40326 2655 0 0 0 named Nov 9 19:07:16 vs302 kernel: [ 850] 0 850 16563 172 0 -17 -1000 sshd Nov 9 19:07:16 vs302 kernel: [ 875] 0 875 23451 240 0 0 0 sshd Nov 9 19:07:16 vs302 kernel: [ 966] 498 966 4780 44 0 0 0 wrapper Nov 9 19:07:16 vs302 kernel: [ 968] 498 968 497404 40812 0 0 0 java Nov 9 19:07:16 vs302 kernel: [ 1057] 0 1057 20216 225 0 0 0 master Nov 9 19:07:16 vs302 kernel: [ 1064] 89 1064 20278 209 0 0 0 qmgr Nov 9 19:07:16 vs302 kernel: [ 1071] 0 1071 27075 121 0 0 0 bash Nov 9 19:07:16 vs302 kernel: [ 1111] 0 1111 24880 350 0 0 0 httpd Nov 9 19:07:16 vs302 kernel: [ 1117] 48 1117 24913 351 0 0 0 httpd Nov 9 19:07:16 vs302 kernel: [ 1118] 48 1118 24880 337 0 0 0 httpd Nov 9 19:07:16 vs302 kernel: [ 1119] 48 1119 24880 337 0 0 0 httpd Nov 9 19:07:16 vs302 kernel: [ 1120] 48 1120 24880 337 0 0 0 httpd Nov 9 19:07:16 vs302 kernel: [ 1121] 48 1121 24880 337 0 0 0 httpd Nov 9 19:07:16 vs302 kernel: [ 1122] 48 1122 24880 337 0 0 0 httpd Nov 9 19:07:16 vs302 kernel: [ 1124] 48 1124 24880 337 0 0 0 httpd Nov 9 19:07:16 vs302 kernel: [ 1125] 48 1125 24880 337 0 0 0 httpd Nov 9 19:07:16 vs302 kernel: [ 1129] 0 1129 29313 151 0 0 0 crond Nov 9 19:07:16 vs302 kernel: [ 1143] 0 1143 1018 22 0 0 0 agetty Nov 9 19:07:16 vs302 kernel: [ 1146] 0 1146 1015 22 0 0 0 mingetty Nov 9 19:07:16 vs302 kernel: [ 1514] 0 1514 23451 237 0 0 0 sshd Nov 9 19:07:16 vs302 kernel: [ 1517] 0 1517 27075 113 0 0 0 bash Nov 9 19:07:16 vs302 kernel: [ 1641] 89 1641 20236 218 0 0 0 pickup Nov 9 19:07:16 vs302 kernel: [ 1659] 0 1659 25234 39 0 0 0 tail Nov 9 19:07:16 vs302 kernel: [ 1660] 0 1660 89903 85712 0 0 0 setsebool Nov 9 19:07:16 vs302 kernel: Out of memory: Kill process 1660 (setsebool) score 568 or sacrifice child Nov 9 19:07:16 vs302 kernel: Killed process 1660, UID 0, (setsebool) total-vm:359612kB, anon-rss:342708kB, file-rss:140kB

    Read the article

  • C# WPF DataBind boolean

    - by jtdangelo
    I have been using this website to learn a lot about C# for a while, but this is my first time posting a question. I look forward to hearing back from some of the seasoned C# veterans! I have been working on a C# 4.0 WPF project and need to figure out how to databind a boolean value. I have a reference to my Application.Current object in a window. My "App" object contains a boolean field called "Downloaded" that is true if the user has downloaded information from a web service. I need to databind a textbox's IsEnabled field to this Downloaded value. Any tips? Here is what I have come up with so far. (Any useful links to better learn WPF XAML are greatly appreciated!) C# Code: class MainWindow : Window { ... private App MyApp = App.Current as App; ... } XAML: <TextBox ... IsEnabled="{Binding Source=MyApp, Path=Downloaded}" /> James

    Read the article

  • debugging scaffolding contingent upon degbugging boolean (java)

    - by David
    Recently i've found myself writing a lot of methods with what i can only think to call debugging scaffolding. Here's an example: public static void printArray (String[] array, boolean bug) { for (int i = 0; i<array.lenght; i++) { if (bug) System.out.print (i) ; //this line is what i'm calling the debugging scaffolding i guess. System.out.println(array[i]) ; } } in this method if i set bug to true, wherever its being called from maybe by some kind of user imput, then i get the special debugging text to let me know what index the string being printed as at just in case i needed to know for the sake of my debugging (pretend a state of affairs exists where its helpful). All of my questions more or less boil down to the question: is this a good idea? but with a tad bit more objectivity: Is this an effective way to test my methods and debug them? i mean effective in terms of efficiency and not messing up my code. Is it acceptable to leave the if (bug) stuff ; code in place after i've got my method up and working? (if a definition of "acceptability" is needed to make this question objective then use "is not a matter of programing controversy such as ommiting brackets in an if(boolean) with only one line after it, though if you've got something better go ahead and use your definition i won't mind) Is there a more effective way to accomplish the gole of making debugging easier than what i'm doing? Anything you know i mean to ask but that i have forgotten too (as much information as makes sense is appreciated).

    Read the article

  • Weird exception: Cannot cast String to Boolean when using getBoolean

    - by La bla bla
    I'm getting a very weird error. I have 2 activities. On both I'm getting the SharedPreferences using MODE_PRIVATE (if it matters) by sp = getPreferences(MODE_PRIVATE); on each activity's onCreate() I'm calling sp.getBoolean(IntroActivity.SHOW_INTRO, true) On the IntroActivity this works fine. But when I'm trying in the main activity, I'm getting this 10-12 04:55:23.208: E/AndroidRuntime(11668): FATAL EXCEPTION: main 10-12 04:55:23.208: E/AndroidRuntime(11668): java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.app.SharedPreferencesImpl.getBoolean(SharedPreferencesImpl.java:242) 10-12 04:55:23.208: E/AndroidRuntime(11668): at com.lablabla.parkme.ParkMeActivity$2.onClick(ParkMeActivity.java:194) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.view.View.performClick(View.java:4084) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.view.View$PerformClick.run(View.java:16966) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.os.Handler.handleCallback(Handler.java:615) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.os.Handler.dispatchMessage(Handler.java:92) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.os.Looper.loop(Looper.java:137) 10-12 04:55:23.208: E/AndroidRuntime(11668): at android.app.ActivityThread.main(ActivityThread.java:4745) 10-12 04:55:23.208: E/AndroidRuntime(11668): at java.lang.reflect.Method.invokeNative(Native Method) 10-12 04:55:23.208: E/AndroidRuntime(11668): at java.lang.reflect.Method.invoke(Method.java:511) 10-12 04:55:23.208: E/AndroidRuntime(11668): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 10-12 04:55:23.208: E/AndroidRuntime(11668): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 10-12 04:55:23.208: E/AndroidRuntime(11668): at dalvik.system.NativeStart.main(Native Method) I made sure that I'm not putting a String somewhere in the middle with that same key Any ideas? Thanks! EDIT: some code: //onCreate() sp = getPreferences(MODE_PRIVATE); // other method boolean showIntro = sp.getBoolean(IntroActivity.SHOW_INTRO, true); // Exception is here showIntroCheckBox.setChecked(showIntro); If it matters, the code which throws the exception is inside a button's onClick

    Read the article

  • lua metatable __lt __le __eq forced boolean conversion of return value

    - by chris g.
    Overloading __eq, __lt, and __le in a metatable always converts the returning value to a boolean. Is there a way to access the actual return value? This would be used in the following little lua script to create an expression tree for an argument usage: print(_.a + _.b - _.c * _.d + _.a) -> prints "(((a+b)-(c*d))+a)" which is perfectly what I would like to have but it doesn't work for print(_.a == _.b) since the return value gets converted to a boolean ps: print should be replaced later with a function processing the expression tree -- snip from lua script -- function binop(op1,op2, event) if op1[event] then return op1[event](op1, op2) end if op2[event] then return op2[event](op1, op2) end return nil end function eq(op1, op2)return binop(op1,op2, "eq") end ... function div(op1, op2)return binop(op1,op2, "div") end function exprObj(tostr) expr = { eq = binExpr("=="), lt = binExpr("<"), le = binExpr("<="), add = binExpr("+"), sub=binExpr("-"), mul = binExpr("*"), div= binExpr("/") } setmetatable(expr, { __eq = eq, __lt = lt, __le = le, __add = add, __sub = sub, __mul = mul, __div = div, __tostring = tostr }) return expr end function binExpr(exprType) function binExprBind(lhs, rhs) return exprObj(function(op) return "(" .. tostring(lhs) .. exprType .. tostring(rhs) .. ")" end) end return binExprBind end function varExpr(obj, name) return exprObj(function() return name end) end _ = {} setmetatable(_, { __index = varExpr }) -- snap -- Modifing the lua vm IS an option, however it would be nice if I could use an official release

    Read the article

  • java threads don't see shared boolean changes

    - by andymur
    Here the code class Aux implements Runnable { private Boolean isOn = false; private String statusMessage; private final Object lock; public Aux(String message, Object lock) { this.lock = lock; this.statusMessage = message; } @Override public void run() { for (;;) { synchronized (lock) { if (isOn && "left".equals(this.statusMessage)) { isOn = false; System.out.println(statusMessage); } else if (!isOn && "right".equals(this.statusMessage)) { isOn = true; System.out.println(statusMessage); } if ("left".equals(this.statusMessage)) { System.out.println("left " + isOn); } } } } } public class Question { public static void main(String [] args) { Object lock = new Object(); new Thread(new Aux("left", lock)).start(); new Thread(new Aux("right", lock)).start(); } } In this code I expect to see: left, right, left right and so on, but when Thread with "left" message changes isOn to false, Thread with "right" message don't see it and I get ("right true" and "left false" console messages), left thread don't get isOn in true, but right Thread can't change it cause it always see old isOn value (true). When i add volatile modifier to isOn nothing changes, but if I change isOn to some class with boolean field and change this field then threads are see changes and it works fine Thanks in advance.

    Read the article

  • Can Microsoft store three-valued fields in a single bit?

    - by fenomas
    I'm completely ignorant of SQL/databases, but I was chatting with a friend who does a lot of database work about how some databases use a "boolean" field that can take a value of NULL in addition to true and false. Regarding this, he made a comment along these lines: "To Microsoft's credit, they have never referred to that kind of field as a boolean, they just call it a bit. And it's a true bit - if you have eight or fewer bit fields in a record, it only requires one byte to store them all." Naturally that seems impossible to me - if the field can hold three values you're not going to fit eight of them into a byte. My friend agreed that it seemed odd, but begged ignorance of the low-level internals and said that so far as he knew, such fields can hold three values when viewed from the SQL side, and it does work out to require a byte of storage. I imagine one of us has a wire crossed. Can anyone explain what's really going on here?

    Read the article

  • Deleting the first occurrence of a target in aList [closed]

    - by Bandz Jooz
    /** Replaces each occurrence of oldItem in aList with newItem */ public static void replace(List<Student> aList, Student oldItemStudent newItem) { int index = aList.indexOf(oldItem); while(index != -1){ aList.set(index, newItem); index = aList.indexOf(oldItem); } /** Deletes the first occurrence of target in aList */ public static void delete(List<Student> aList, Student target){ Object o = //stuck here, dont know how to set up boolean stuff } } I figured out how to do the first method by looking up Java documentation, however I can't figure out how to finish my code for the second method even though I looked up the documentation which states: boolean remove(Object o) Removes the first occurrence of the specified element from this list, if it is present.

    Read the article

  • Boolean logic parser for SQL

    - by d03boy
    This is going to sound crazy but does anyone have techniques that would allow me to parse boolean logic strings in Sql Server 2005 without extraordinary/rediculous effort? Here is an example: (SOMEVAR=4 OR SOMEVAR=5) AND (NOT OTHERVAR=Y) I feel like recursion would help a lot if that were possible in Sql but I'm not really sure how to go about that sort of thing. If not, maybe there's a way to attach an external system to do the recursion for me? Don't worry, I'm not getting my hopes up.

    Read the article

  • Converting from a string to boolean in Python?

    - by Joan Venge
    Does anyone know how to do convert from a string to a boolean in Python? I found this link. But it doesn't look like a proper way to do it. I.e. using a built in functionality, etc. EDIT: The reason I asked this is because I learned int("string"), from here. I tried bool ("string") but always got True.

    Read the article

  • global static boolean pointer causes segmentation fault using pthread

    - by asksw0rder
    New to pthread programming, and stuck on this error when working on a C++&C mixed code. What I have done is to call the c code in the thread created by the c++ code. There is a static boolean pointer used in the thread and should got free when the thread finishes. However I noticed that every time when the program processed into the c function, the value of the boolean pointer would be changed and the segmentation fault then happened due to the free(). Detail code is as follows: static bool *is_center; // omit other codes in between ... void streamCluster( PStream* stream) { // some code here ... while(1){ // some code here ... is_center = (bool*)calloc(points.num,sizeof(bool)); // start the parallel thread here. // the c code is invoked in this function. localSearch(&points,kmin, kmax,&kfinal); // parallel free(is_center); } And the function using parallel is as follows (my c code is invoked in each thread): void localSearch( Points* points, long kmin, long kmax, long* kfinal ) { pthread_barrier_t barrier; pthread_t* threads = new pthread_t[nproc]; pkmedian_arg_t* arg = new pkmedian_arg_t[nproc]; pthread_barrier_init(&barrier,NULL,nproc); for( int i = 0; i < nproc; i++ ) { arg[i].points = points; arg[i].kmin = kmin; arg[i].kmax = kmax; arg[i].pid = i; arg[i].kfinal = kfinal; arg[i].barrier = &barrier; pthread_create(threads+i,NULL,localSearchSub,(void*)&arg[i]); } for ( int i = 0; i < nproc; i++) { pthread_join(threads[i],NULL); } delete[] threads; delete[] arg; pthread_barrier_destroy(&barrier); } Finally the function calling my c code: void* localSearchSub(void* arg_) { // omit some initialize code... // my code begin_papi_thread(&eventSet); // Processing k-means, omit codes. // is_center value will be updated correctly // my code end_papi_thread(&eventSet); // when jumping into this, error happens return NULL; } And from gdb, what I have got for the is_center is: Breakpoint 2, localSearchSub (arg_=0x600000000000bc40) at streamcluster.cpp:1711 1711 end_papi_thread(&eventSet); (gdb) s Hardware watchpoint 1: is_center Old value = (bool *) 0x600000000000bba0 New value = (bool *) 0xa93f3 0x400000000000d8d1 in localSearchSub (arg_=0x600000000000bc40) at streamcluster.cpp:1711 1711 end_papi_thread(&eventSet); Any suggestions? Thanks in advance!

    Read the article

  • Learning material on SAT (Boolean Satisfiability Problem)

    - by Jules
    What are good documents to read on SAT (Boolean satisfiability problem) solvers. I have not been able to find good material via Google. The documents I found were either birds eye view, too advanced or corrupted PDF files... Which papers/documents do you recommend to learn about the algorithms in modern practical SAT solvers?

    Read the article

  • mvc bind/post boolean to radiobutton

    - by Xuan Vu
    Hi all, I have a column in my Model with a NULLABLE boolean value. Now on my View (for editing), I would like to bind that to two radiobuttons: Yes & No. If the value is null, then just have the two radiobutton un-checked. How would I go to do that? Thanks.

    Read the article

  • Python style: if statements vs. boolean evaluation

    - by mkscrg
    One of the ideas of Python's design philosophy is "There should be one ... obvious way to do it." (PEP 20), but that can't always be true. I'm specifically referring to (simple) if statements versus boolean evaluation. Consider the following: if words: self.words = words else: self.words = {} versus self.words = words or {} With such a simple situation, which is preferable, stylistically speaking? With more complicated situations one would choose the if statement for readability, right?

    Read the article

  • Why Boolean And bool

    - by Asim Sajjad
    From the link ( which is mentioned in Question) my question is that microsoft says "The C# type keywords and their aliases are interchangeable" But why we need Aliases, From my point of view Boolean is more meaningful then bool and Int32 is more meaningful then int then why aliases ???

    Read the article

  • good methods for boolean operations on overlapping polygons

    - by BenjaminGolder
    What is the best open source library for performing boolean operations (union, intersect, subtract) on shapefiles? What do you like to use? OGR looks like it probably has this capability, though I'm having trouble finding the particular commands in their documentation. Shapely definitely does this, and is easy to understand. PostGIS appears to also have some commands for this. But there must be more, and I'm having trouble finding them. I don't have much experience with any of the, and would appreciate any opinions on these or other libraries. Thanks!

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >